Hot answers tagged

10 votes
Accepted

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

There's plug-in wellle/context.vim which seems to implement what you requested. (Perhaps it's the one D. Ben Knoble was trying to recall?) It will try to show context (if, for or while block, function/...
filbranden's user avatar
  • 28.4k
7 votes
Accepted

Improve `gf` such that it would jump to the exact line, if possible

What you want already exists: :help gF. Note that gF behaves like gf in the absence of a line number so you can default to gF if you don't want to think too much about which command to use in which ...
romainl's user avatar
  • 39.3k
5 votes
Accepted

Jedi module is not found (deoplete)

In my case I had to run this command: pip3 install --user jedi
SergioAraujo's user avatar
  • 1,167
5 votes

How to configure neovim to properly format python code?

Here is an example of how to make this work with lspconfig ~/.config/nvim/init.lua require("_plugins") ~/.config/nvim/lua/_plugins.lua local fn = vim.fn local install_path = fn.stdpath(&...
casonadams's user avatar
4 votes
Accepted

nvim-completion-manager: neovim shows a Python syntax error in cm.py when opening a new file i despite no actual syntax error in file

The syntax error is happening because the function call is passing an async=True keyword argument. The async term has become a reserved keyword in recent Python, so it's not allowed as a keyword ...
filbranden's user avatar
  • 28.4k
4 votes
Accepted

Installing vim8.2 with python3.8 : Python.h not found

You mention in the comments, that the file Python.h is located in the directory $LOCAL_INSTALL/include/python3.8. This directory is not in the search path for include files. So it has to be added ...
Ralf's user avatar
  • 9,097
3 votes
Accepted

Is there a way to make vim use a python3 interpreter which is not explicitely installed under Windows 10?

The C API of Python evolves with the version of Python. In this case, function PySlice_AdjustIndices was introduced in this commit to supercede function PySlice_GetIndicesEx, but it seems this ...
filbranden's user avatar
  • 28.4k
3 votes
Accepted

Exclude trailing newline when reading in skeleton file

:read inserts text from a given file. When you start with empty file, it already has one (virtual, empty) line. So if you do :0read then the text is added after 0th line (that is, before the first and ...
Matt's user avatar
  • 20.4k
3 votes
Accepted

Cannot find implementation or library stub for module named "flask"

As we sussed out in the comments, this is from ALE+mypy, which needs to be installed in the virtual-env of the project. Why? I'm not 100% sure, but I suspect mypy is simply ignorant of virtual-...
D. Ben Knoble's user avatar
  • 25.4k
3 votes

How to let Vim work with pyenv?

Here are the commands I use to create a python 3.6.0 pyenv on a Mac using homebrew. Please note that I use neovim but the process to create a pyenv will not be much different for vim. Install ...
Benjamin Frazier's user avatar
3 votes
Accepted

Is there a vim that uses python instead of vimscript throughout?

You can try reading the Vim :help python help page. There's a lot there to get started. It's not easy though. Caution... your version of Vim must be recent enough it must have been installed with ...
Chris Heithoff's user avatar
3 votes
Accepted

Python not working on Windows

The first things to determines to make Python working are: Is Python compiled for Python? What is the Vim architecture (32 Bit or 64 Bit)? What is the Python version that Vim expects (3.6, 3.10, ...)?...
Vivian De Smedt's user avatar
2 votes
Accepted

Is there a way to create a new file from the editior once I have a file open?

What I would do is the following: ESC :w to write (save) the file. Then :e number12.py. That will open a new buffer in the current window, if the file doesn't exist.
Herb's user avatar
  • 1,203
2 votes
Accepted

Vim thinks Python @ operator is decorator

As Martin points out in the comments, this has been fixed. Either update vim or add the newer syntax file to your configuration.
2 votes
Accepted

UltiSnips shows error with Python `If-Else`

It seems that when you copied the snippet you forgot to add the indentation spaces in the python snippet conditional code as shown in the error message: Executed snippet code: 1 2 if t[2] and t[...
Vicente Bolea's user avatar
2 votes

Evaluate an expression from visual selection in Python

If you have a Vim version with Python support (you can check that in vim --version or :version and see if you have +python3 or +python3/dyn), then you can use py3eval() to evaluate the expression ...
filbranden's user avatar
  • 28.4k
2 votes

VimWiki - create a "smart" index page for subdir/section of wiki?

I haven't had time to test more than the first code-block, but the others are mostly mechanical transformations. function MyLinks(pat, strip) abort return glob(a:pat, v:false, v:true) \ ->...
D. Ben Knoble's user avatar
  • 25.4k
2 votes
Accepted

Ignore lines with string in errorformat

There are a few minor issues with most of your lines ignoring specific patterns. %-G%Oh no!\ %m : You have an extra % there, turning the first character into a %O (a command to overread the matched ...
filbranden's user avatar
  • 28.4k
2 votes
Accepted

`termwinsize` cannot be accessed from Python 3

It is actually the expected behavior, although that is clearly not what was intended. The key is that 'termwinsize' is "local to window", whereas 'buftype' is "local to buffer". ...
husB's user avatar
  • 2,008
2 votes

Use poetry shell in Vimspector

I think you should create your own adapter in your vimspector configuration. You can find help in this documentation. Here a configuration I use to run vimspector with poetry and debugpy: { "...
Squioc's user avatar
  • 31
2 votes

Make LanguageServer aware of requirements without activating virtual environment (Python)

As statox pointed out in a comment, there is probably no way around having the dependencies installed somewhere on the machine: Your LSP server needs to have the declarations stored somewhere, if you ...
Jonathan Scholbach's user avatar
2 votes

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I think I've heard of a plugin that does this, but I cannot recall it's name. When I need this I do one of two things: Create a split. I lean towards vertical splits, since my monitor is wider than ...
D. Ben Knoble's user avatar
  • 25.4k
2 votes

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I would recommend writing a plugin that adds some text to your statusline. You can create a function that returns the text of the previous line that has one less unit of indentation (use indent()) ...
Chris Heithoff's user avatar
2 votes

vim broken after python update (error while loading shared libraries: libpython3.9.so.1.0)

The numbers usually bear some meaning. For Python, 3 is language version which is obviously very different from 2. While 9 or 10 denote incompatible ABI revisions. Hence the shared objects include ...
Matt's user avatar
  • 20.4k
2 votes

Python not working on Windows

Once I had the correct version of Python installed on Windows, I figured out the best way to add it to the configuration is like this, so that it does not need to be changed every time you upgrade vim/...
paradroid's user avatar
  • 365
2 votes

Separate virtualenv for vim plugins and application code

Adding the following snippet at the start of .vimrc restores the default python environment. if has_key(environ(),"VIRTUAL_ENV") let $PATH=substitute($PATH,join([$VIRTUAL_ENV,"...
vijayvithal's user avatar
1 vote

How to add python3 interface to vim?

It looks like there's some issue with your Homebrew setup or with the Vim build in your Homebrew. When you type which vim does it show you /usr/local/bin/vim? That's the one from Homebrew. If it doesn'...
filbranden's user avatar
  • 28.4k
1 vote

No fold found with python code, mac and debian

EDIT You also need to add the following line to your vimrc: filetype plugin indent on See :h :filetype-plugin-on and :h :filetype-indent-on this command enable the filetype detection and the loading ...
statox's user avatar
  • 49.4k
1 vote
Accepted

Convert print statements to log statements using a custom mapping

A substitution like this works for all scenarios: %s/print(\(.*\))/log.info(" ".join([\1]))/ Grab everything within print brackets (.*) using regex replace the match with a join statement ...
Ayush Mandowara's user avatar
1 vote
Accepted

Environment variables on vimspector

I followed the instructions given by puremourning at https://www.reddit.com/r/vim/comments/mbdt2e/environment_variables_on_vimspector/ I used a shell variable to run a script whose output is the JSON ...
user3348949's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible