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/...
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 ...
5
votes
Accepted
Jedi module is not found (deoplete)
In my case I had to run this command:
pip3 install --user jedi
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(&...
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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, ...)?...
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.
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.
Community wiki
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[...
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 ...
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)
\ ->...
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 ...
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".
...
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:
{
"...
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 ...
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 ...
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())
...
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 ...
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/...
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,"...
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'...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
python × 76neovim × 17
vimrc × 8
lsp × 7
gvim × 5
filetype-python × 5
indentation × 4
plugin-ale × 4
plugin × 4
vimscript × 3
microsoft-windows × 3
linux × 3
plugin-you-complete-me × 3
vimscript-python × 3
syntax-highlighting × 2
autocmd × 2
formatting × 2
plugin-ultisnips × 2
macos × 2
error × 2
tmux × 2
linux-ubuntu × 2
plugin-vimwiki × 2
errorformat × 2
debugging × 2