Skip to main content
15 votes
Accepted

Vim 8.0 Python support

The pi-rho/dev PPA now supports Vim 8, and like it always has, includes support for Python/Python3: $ vim --version | grep python +cryptv +linebreak +python/dyn +vreplace +cscope ...
muru's user avatar
  • 25k
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 ...
João A. Toledo's user avatar
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.
CyclicUniverse's user avatar
10 votes

How to get Python support on MS Windows?

You need to install Python yourself on Windows. If you type :version, you should see +python/dyn and +python3/dyn. On Windows, this means that Vim is compiled to dynamically load the Python DLL. You ...
Tommy A's user avatar
  • 6,790
9 votes
Accepted

How can I get python library help in vim?

Try using the jedi-vim plugin. It uses Jedi to get completions and is much better at doing so than python-rope is. It will resolve np.array to numpy.array and show the appropriate documentation in a ...
Tommy A's user avatar
  • 6,790
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 ...
Peter Rincker's user avatar
8 votes

Vim 8.0 Python support

From your question it appears that you have installed vim-tiny 8.0 that is a very minimal Vim runtime without plugins. You can confirm this using this: dpkg -l | grep vim You can have several Vim ...
Yonsy Solis's user avatar
8 votes
Accepted

how to change python interpreter used by jedi-vim

I was able to fix it myself by providing jedi-vim with the location of the packages in my anaconda folder using the $PYTHONPATH variable as follows: export PYTHONPATH=$PYTHONPATH:/home/user1/...
R. Doe's user avatar
  • 321
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 ...
PersianGulf's user avatar
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-...
Ralf's user avatar
  • 9,287
6 votes
Accepted

How to use the argument of a vimscript function in an inner python function?

You can use the vim package inside python, you should be able to gain access to vim: function! Test(myArgument) python << EOF import vim def test(myArgument): print "My argument " + ...
nobe4's user avatar
  • 16.1k
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, ...
finn's user avatar
  • 271
6 votes

Vim 8.0 Python support

you should use sudo apt-get install vim-nox instead, to get a "huge-version".
skywind3000's user avatar
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 ...
laktak's user avatar
  • 2,953
6 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') | ...
Maxim Kim's user avatar
  • 13.6k
5 votes

Vim 8.0 Python support

You should install vim from source. That way, you have control over what is included. See the following for more info and a step by step walkthrough. It is relatively easy. https://github.com/...
Xero Smith's user avatar
5 votes

Elegant way to support both python and python3 in vim plugin

If you want to avoid rewriting the Python script, put it in a separate file and use :pyfile or :py3file instead. let script_path = expand('<sfile>:p:h') . '/script.py' if !has('python') and !...
Tommy A's user avatar
  • 6,790
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. ...
superphunthyme's user avatar
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 ...
D. Ben Knoble's user avatar
  • 26.6k
4 votes
Accepted

How can I get more features?

If you want more features (and something more up to date than whats in the apt packages), you have to compile it yourself. You say you are on Debian, and all these should work on that platform. You ...
DoYouEvenCodeBro's user avatar
4 votes

how to change python interpreter used by jedi-vim

You can't. The :python and :python3 commands always use the compiled-in interpreters. If you have a recent version of Vim with python and / or python3 loaded dynamically (see :h python-dynamic) you ...
Sato Katsura's user avatar
  • 4,019
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')
Mass's user avatar
  • 14.2k
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/...
Yegappan Lakshmanan's user avatar
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 ...
artificerpi's user avatar
3 votes

Elegant way to support both python and python3 in vim plugin

My technique for distinction of the python versions is to create a separate command (although this is in my .vimrc startup files, you can modify as needed for the plugin code.) function! PyImports() ...
Cometsong's user avatar
  • 581
3 votes

How do I use Python plugins on Windows?

So I had a very similar problem on my Windows 10 but for 64 bit vim and python. TL;DR The problem has nothing to do with YouCompleteMe in my case. Suppose YCM is complied with python 3. To make ...
Chen XI's user avatar
  • 101
3 votes

Python integration in Vim on Raspberry Pi

If you are looking for a terminal version of vim which supports python (alongs with Lua, Perl, Ruby, and Tcl) without a GUI. I'd recommend to use the vim-nox package. You can install it with sudo ...
statox's user avatar
  • 50.1k
3 votes
Accepted

Start and attach to neovim in same python file

Your problem is that you're starting a Neovim subprocess and it's blocking before processing the rest of your script. When you quit Neovim, the rest of the script executes well after the file socket ...
Tommy A's user avatar
  • 6,790
3 votes

how to change python interpreter used by jedi-vim

2018+ Jedi Versions You can just use :let jedi#force_py_version=3.8 if you want to switch to the latest Python version, for example. Unfortunately there is no environment listing in jedi-vim, yet. We ...
Dave Halter's user avatar
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.
codejedi's user avatar

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