12
votes
Installing or building vim with +python3 support for Python 3.7.x on linux
make clean distclean
before running the configure command for vim. This worked for me. There was lots of cached items hanging around from before that were interfering with vim configure.
12
votes
Accepted
Installing or building vim with +python3 support for Python 3.7.x on linux
Probably your default python3 is 3.6. You need, then, tell the build process to use python3.7. You can do that with the parameters --with-python3-command:
./configure --with-python3-command=python3.7 ...
9
votes
Accepted
Drawbacks of using Python to develop new code in a VIM plugin
TL;DR:
Requiring +python/+python3 support for a python based development plugin. That sounds completely reasonable.
About Vim plugins and human behavior
Generally, speaking humans want things to ...
8
votes
Accepted
Creating a hidden buffer
I'm not aware that you can create a hidden unnamed buffer.
But you can create a hidden (even unlisted) buffer with some fancy name and use that.
In VimScript:
let g:myscratch = bufnr("my-fancy-...
8
votes
Accepted
requires Vim compiled with Python (2.7.1+ or 3.4+) support
When you want to run ./configure, You have 3 options for python:
--enable-pythoninterp=yes
--with-python-command=/usr/bin/python
--with-python-config-dir=
last parameter is deprecated, You have to ...
7
votes
Accepted
Quit script after a certain condition is true
Use :finish:
if hasNoDependency()
finish
endif
" all dependencies are met, good to go
" ...
I use it for minpac plugin manager (not only here of course):
if !exists('*minpac#init') | ...
6
votes
Vim 8.0 Python support
Solution 1 :
Install VIM Editor(Install any one of them of vim variant) :
vim-gtk3 :- This package contains a version of vim compiled with a GTK3 GUI and support for scripting with Lua, Perl, ...
6
votes
Accepted
How to write a plugin that works for both Python3 and python?
See help pythonx in Vim 8:
Because most python code can be written so that it works with python
2.6+ and python 3 the pyx* functions and commands have been written. They work exactly the same as ...
5
votes
How to run a python command based on a matched group of a pattern?
TL;DR
There is no simple way to get capture groups into other commands. They simply don't see them.
About the :s command
As many vim users know, :s is the :substitute command, and it deals in vim's ...
5
votes
Accepted
Vim is unable to find Python
Have a look at :help python3 and the subsequent sections on python-2-and-3 and pythonx. If python is compiled with +python/dyn, +python3/dyn, then it effectively has support for Python 2 and 3.
...
4
votes
Accepted
How to assign a Python list to a vim variable and escape its strings correctly
Use pyeval(), py3eval(), or pyxeval() to read python variables into vim:
python:
x = [1,2,3]
vim.command('let X = pyeval("x")')
vim:
py x = [1,2,3]
let X = pyeval('x')
4
votes
Accepted
Programming Vim in Python: how is it implemented?
The source files used for the Python integration with Vim are:
https://github.com/vim/vim/blob/master/src/if_python.c
https://github.com/vim/vim/blob/master/src/if_python3.c
https://github.com/vim/vim/...
3
votes
Why is Vim's Python version compiled in?
Vim can be build with static python or dynamic python support. If it is build with dynamic python you are able to change the python version.
Just look at the output of :version. If it contains +...
3
votes
Elegant way to support both python and python3 in vim plugin
Here's how youcompleteme does.
Define a function for determining whether python3 is available:
function! s:UsingPython3()
if has('python3')
return 1
endif
return 0
endfunction
then get ...
3
votes
Trying to compile vim with python 3.6. Where is my config directory?
Although not pretty sure, I guess you are on a x64 platform. The corresponding path is under /usr/lib64/pythonXX.
3
votes
Inserting text with the Python interface
It is generally easier to use pyeval (py3eval, pyxeval) and the expression register:
imap <c-x><c-r> <c-r>=pyxeval('python expression')<cr>
3
votes
Accepted
Ultisnips py3 errors
The error you are getting is happening because your Vim doesn't include support for Python, which is required by UltiSnips, as that plug-in is implemented in Python for the most part.
My ...
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
Gvim E370: cannot load library python36.dll with installed Python 3.8
Is it possible to force Gvim to use python38.dll or it should be recompiled with python 3.8? Probably if I install the Python3.6 it will work. Is it necessary to recomile every time there is new ...
3
votes
Accepted
Contextual Snippets in UltiSnips not working
The problem is that you have updated your plugins in the transition Linux to Mac. This also brings a major update of Vimtex, in which the syntax plugin has been included as part of Vimtex. Part of the ...
3
votes
Accepted
Stop vim from deleting expanded tab as a block of spaces
What you're seeing is the result of having 'softtabstop' (alias 'sts') set to a non-zero value. It makes a lot of sense for this to be set in Python files where spacing matters since backspacing over ...
2
votes
How to run a python command based on a matched group of a pattern?
As said by the other answers you can not reuse the search pattern and the subgroups with every command. So here is another general way that works with every command: use :execute, getline() and ...
2
votes
How to run a python command based on a matched group of a pattern?
It ain't pretty, but it is possible. The following achieves your pseudo code of :g/aaa\(.*\)/python3 print("\1"*3)
:%s/aaa\(.*\)/\=submatch(0) . execute('python print("'.submatch(1).'"*3)')
N.B. Note ...
2
votes
Accepted
configure VIM with Python support for Debian 9.4 VM Instance
Here is what ended up working for me
./configure --enable-python3interp / --with-python3-command=/usr/bin/python3
Between this link and a suggested answer which has since been deleted, I cleaned and ...
2
votes
Accepted
How to set internal vim variable from python code
For a vim plugin with python, you may first import the vim module (see :h python-vim).
import vim
Then there is vim.command(cmd) to execute an Ex command, so in your case
vim.command('let g:...
2
votes
How do I configure the python location?
Add the following to your vimrc:
set pythonhome=C:\randomplace\python
set pythondll=C:\randomplace\python\python27.dll
For python3 use pythonthreehome and pythonthreedll.
For this to work python ...
2
votes
Installing or building vim with +python3 support for Python 3.7.x on linux
I had the same error message
checking if compile and link flags for Python 3 are sane... no
and was running essentially the same command. The issue was with the line:
--with-python3-config-dir=/...
2
votes
Drawbacks of using Python to develop new code in a VIM plugin
Speaking for myself, mostly in Windows but sometimes other platforms, I've never been satisfied by the reality of the Python integration. I appreciate that it's there for the folks that need it but it ...
2
votes
Accepted
The :python command doesn't work - E319: Sorry, the command is not available in this version
The problem was solved.
The :python3 or :pythonx (:py3 or :pyx) should be used instead of the simple :python.
See :h python3 and :h pythonx.
So, :py3 print("hello") gives hello as expected.
Also, ...
2
votes
Ultisnips py3 errors
This might be the problem with vim version.
I reinstalled the vim using brew, and alias it.
brew remove vim
brew cleanup
brew install vim
Then, added following in my ~/.zshrc (for bash users ~/....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vimscript-python × 108vimscript × 20
microsoft-windows × 15
neovim × 8
plugin-system × 7
gvim × 6
linux × 6
plugin-ultisnips × 6
plugin-you-complete-me × 6
vimrc × 5
installing × 5
buffers × 4
macos × 4
python × 3
linux-ubuntu × 3
terminal × 2
functions × 2
replace × 2
error × 2
snippets × 2
compile-vim × 2
hidden-buffers × 2
version × 2
linux-debian × 2
async × 2