Questions tagged [vimscript-python]

For questions about The Python interface to Vim; DO NOT use for questions with Python examples or about syntax highlighting in Python.

Filter by
Sorted by
Tagged with
0 votes
1 answer
500 views

configure VIM with Python support for Debian 9.4 VM Instance

I'm trying to configure VIM with Python support in order to use the You Complete Me pluggin. This question has been asked before. Unfortunately none of the answers have worked for me. Any suggestions ...
lando2319's user avatar
  • 133
0 votes
1 answer
144 views

How do I split a vim Window using python?

The vim documentation of the Python interface to vim mentions: The height attribute is writable only if the screen is split horizontally. The width attribute is writable only if the screen is ...
wander95's user avatar
  • 123
3 votes
1 answer
12k views

requires Vim compiled with Python (2.7.1+ or 3.4+) support

I compiled vim8.1 with the following options : $ vim --version VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 18 2018 09:50:18) Included patches: 1-320 Compiled by mohsen@ns1 Huge version with GTK2 ...
PersianGulf's user avatar
1 vote
0 answers
287 views

How vim invokes and executes python interpreter

What is happening under the hood when we type :w !python3 in VIM. Does it invoke the system-wide python3 or the one present in the virtual environment? My script: import sys sys.path.append('./...
Bussller's user avatar
  • 141
5 votes
4 answers
478 views

How to run a python command based on a matched group of a pattern?

Let say I want to run a command that uses a matched group of a pattern for each line matching the pattern. The natural choice is :g. With the command :s, there is no problem. If i would do :g/aaa\(....
eyal karni's user avatar
  • 1,106
3 votes
2 answers
2k views

Vim is unable to find Python

I'm using Vim on Fedora 28 and Python seems to be enabled: vim --version VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 11 2018 10:00:51) Included patches: 1-177 Modified by <[email protected]&...
Zoltan King's user avatar
0 votes
0 answers
66 views

`vim.eval('a:items')` fails if 'a:items' contain `BOM HEADERs`

I am using a pluging ctrlp-py-matcher, which is using the python interface to vim. My VIM is compiled with python3 support VIM - Vi IMproved 8.1 (2018 May 17, compiled Jul 1 2018 10:45:10) Included ...
alpha_989's user avatar
  • 901
0 votes
1 answer
327 views

Python integration not working as usual

I am compiling Vim on Linux (18.04 Ubuntu) on a new environment and I am experiencing an issue with a lot of my vimrc configuration, which has some inline python logic. Basically the python code just ...
Steven Lu's user avatar
  • 2,251
1 vote
1 answer
74 views

Is `width` a parameter of the Python object `vim.current.window`?

I am trying to use PYthon to interface with VIM in my vimrc. I am aware that this can be done in vimrc in VIML, but I don't want to learn VIML too much, and am already familiar with Python. I looked ...
alpha_989's user avatar
  • 901
1 vote
2 answers
2k views

Python support using pyenv

I am at the end of hour-long research on why I cannot install vim with proper python support. Problems already recognized: Impossible to install python 2 and 3 support together on ubuntu 16.04; oh ...
simlei's user avatar
  • 113
1 vote
0 answers
84 views

Vim package development python support for 2, 3, or both?

Apparently there are some issues preventing vim from being built with both python and python3 support under many linux distributions and OSX. This makes it difficult or impossible for many users to ...
intuited's user avatar
  • 329
0 votes
1 answer
1k views

passing arguments to pyfile/py3file function

I try to do something similar to this question. E.g. I have a python script in a file /tmp/testme.py which should do different things depending on what argum ents are passed to it: import vim ...
pseyfert's user avatar
  • 219
9 votes
2 answers
2k views

Drawbacks of using Python to develop new code in a VIM plugin

In one of the vim plugins I use, we have been thinking about using python vs vimscript going forward (https://github.com/python-mode/python-mode/issues/813#issuecomment-344754563). I understand that ...
alpha_989's user avatar
  • 901
10 votes
2 answers
5k views

Trying to compile vim with python 3.6. Where is my config directory?

I'm a bit of a noob when it comes to Linux, only started using it recently. However, I am trying to compile vim with python because I am using latex live preview and it needs a python compiled vim ...
Mobius-User's user avatar
4 votes
1 answer
488 views

How to write a plugin that works for both Python3 and python? [duplicate]

I feel like this might be because of my lack of vimscript knowledge. Basically I want to write a patch for this plugin https://github.com/actionshrimp/vim-xpath to make it work for python3 (and hence ...
JonnyRaa's user avatar
  • 1,191
1 vote
1 answer
206 views

pyeval not working on vim -u NONE or vim diffs

:echo pyeval('vim.current.window.col') works fine on a normal Neovim instance. But if I start Neovim in diff mode or with the -u NONE option and try the same command, I get this error: Error ...
Jerome Dalbert's user avatar
0 votes
1 answer
248 views

(OSX) Can't run gvim from gvim

I make a file called run_gvim_thing.sh in my home dir. Inside of that is the command gvim myfile.py && echo "yay". If I run that file from terminal it launches gvim with myfile.py. If I run ...
CornSmith's user avatar
  • 131
1 vote
1 answer
297 views

Error when trying to call pymode#rope#goto_definition() with vim's -c arg

If I call gvim main.py -c "call cursor(41, 45)" -c "call pymode#rope#goto_definition()" Then I get this error about parenthesis: "main.py" [unix] 54L, 1677C Error detected while processing command ...
CornSmith's user avatar
  • 131
0 votes
1 answer
662 views

Python quit unexpectedly [closed]

When I start vim (homebrew installation, /usr/local/bin/vim), I get the error "Python quit unexpectedly." How do I make python work with my vim? $ which vim /usr/local/bin/vim $ which python /usr/...
minseong's user avatar
  • 2,323
0 votes
1 answer
520 views

No python support [duplicate]

I recently started out with gVim 8 for windows and i noticed that the higher end plugins that provide more functionality require python support or something like that. But for some reason i am not ...
DirtyAxe's user avatar
1 vote
1 answer
155 views

Vim 8.0 python support: where to store a per-buffer python variable?

Context Python integration in Vim 8.0 provides a handful of useful python objects in vim module. In particular, there are per-buffer objects accessible via vim.buffers list and vim.current.buffer. ...
intelfx's user avatar
  • 317
2 votes
1 answer
984 views

Vim crash with :py3 import sys; print(sys.version)

Windows 8 Vim 8.0.584, 32 bit from https://tuxproject.de/projects/vim/ .7z archives: x86 python36.dll, 32 bit from https://www.python.org/ftp/python/3.6.0/python-3.6.0-embed-win32.zip copied python36....
vbd's user avatar
  • 183
2 votes
1 answer
1k views

Vim 8.0 breaks YCM on Windows 10

I was using Vim 7.4 with YCM quite successfully (thank you for YCM!) and just today noticed that Vim 8.0 was out. I downloaded, installed, started and now it complains that "YouCompleteMe unavailable: ...
BotWhisperer's user avatar
2 votes
1 answer
347 views

How to automate populating Python's class constructor?

I've done some searching with various keywords, but unsuccessfully. Sorry for my English, I'm not a native speaker. I'm new to VIM and to Python, and I'm learning both on the go as much as I can, but ...
Mr n's user avatar
  • 21
7 votes
1 answer
8k views

How to get Python support on MS Windows?

I've installed the latest version of Vim to date (8.0) for Windows. But the version of Vim I've got does not have Python support. I've downloaded the .exe version directly from vim.org. echo has('...
Gustav Blomqvist's user avatar
9 votes
3 answers
2k views

Elegant way to support both python and python3 in vim plugin

I recently received a pull request to change my vim plugin to make it support python3. But these changes break the plugin for the vim on my Mac which seems to listen to python. python import sys ...
mipmip's user avatar
  • 191
26 votes
7 answers
40k views

Vim 8.0 Python support

I'm trying to upgrade my Vim installation to version 8.0, but it doesn't support both Python and Python 3 as the below image. (PS: Because of this problem, I cannot use the YCM (YouCompleteMe) plugin ...
Hyun Ho Yeo 's user avatar
0 votes
1 answer
604 views

Vim problem installing python 3.5 from source

I have installed python 3.5 from the official source, and everything was working. I decided to try vim as a sort of command line IDE. Most plugins worked with vim, but when I tried YouCompleteMe for ...
jath03's user avatar
  • 101
1 vote
2 answers
2k views

Vim python backend, how to import user installed shared libraries?

I (very) often write python, and I use Vim's python3 backend to test my code. To perform my tests I use: vnoremap <localleader>p y:<c-r>"<c-b>python3 <cr> It simply takes my ...
grochmal's user avatar
  • 1,656
14 votes
7 answers
15k views

how to change python interpreter used by jedi-vim

I have Anaconda (including python3.5.2), VIM (7.4) and Jedi-VIM installed on my system. There was also a python installed on the linux system by default. The autocompletion is working on base ...
R. Doe's user avatar
  • 321
1 vote
1 answer
3k views

Python integration in Vim on Raspberry Pi

I am relatively new to programming, and I built a mobile computer with a Pi at its heart to learn on the go. Ideally, I would use Vim as my IDE for Python 3. However, every attempt at installation ...
rkoehler's user avatar
2 votes
0 answers
897 views

python-mode python interpreter & cjrh/vim-conda

I'm having a bit of trouble with running scripts with python-mode while in a specific conda virtual environment. I've installed spf13 & an additional plugin (vim-conda) which allows to change ...
Eralde's user avatar
  • 21
1 vote
1 answer
598 views

How can I get more features?

My vim version is "huge" without GUI. Nevertheless, it is missing a lot of features like clipboard and python. How can I get a more full-featured version? I read that there is a version vim-nox which ...
Tyler Durden's user avatar
  • 2,101
6 votes
1 answer
528 views

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

I have the following vimscript: it contains a vimscript function which executes a python code thanks to python << EOF: function! Test(myArgument) python << EOF def test(myArgument): ...
statox's user avatar
  • 49.9k
4 votes
1 answer
571 views

Start and attach to neovim in same python file

I have a working prototype for some kind of linux-based neovim-app. Sole functionality is "vsplit if 'k' is pressed". It is based on tarruda's nvim-terminal-edit-py. It is started through start_nvim....
Markus's user avatar
  • 175
2 votes
1 answer
568 views

Conflict between python used by vim and by YouCompleteMe

YCM does not work for the reason given above. When I type :python import sys; print sys.version I obtain: 2.7.9 (default, Dec 13 2014, 15:13:49) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] ...
balborian's user avatar
  • 143
5 votes
1 answer
2k views

How can I get python library help in vim?

I tried python-mode, it seems that it can work when I press K on "numpy.array", but if I want to press K on "np.array", it won't work.
yihui.dev's user avatar
  • 153
2 votes
2 answers
1k views

What does vim try to tell me with: 'Sorry, this command is disabled, the Pythons's site module could not be loaded'?

I try to get python support in gvim on windows to work with the help of this binary distribution. First I got the error python27.dll could not be located, what I successfully fixed by copying python27....
sro5h's user avatar
  • 131
3 votes
1 answer
5k views

How to resolve "requires Vim compiled with Python 2.x support" when launching Vim?

I have Vim 7.4 installed on Windows 10 as part of a Mingw64 installation. I installed the YouCompleteMe plugin on it through Vundle, then ran the install.py, which completed successfully. Now, every ...
Edy Bourne's user avatar
5 votes
3 answers
5k views

How to access a custom python module inside vim?

This is a Python 2.7 question. I have a custom python 2.7, that I have compiled and have been using successfully across my system. My custom python has the YAML modules installed as well. The system ...
mbilyanov's user avatar
  • 707
4 votes
1 answer
1k views

neovim: autocompletion on user defined command plugin

I am write a plugin for neovim in python using this client and I looking for a way to offer completion when executing a command. I have look at the following example to structure my plugin. As an ...
kokito's user avatar
  • 201
9 votes
2 answers
4k views

How do I use Python plugins on Windows?

I have Windows 7 64-bit, with python 2.7.11 and python 3.5.1 (both 32-bit) installed, and I have compiled vim with python/dyn and python3/dyn, but I keep getting the following error: :py print "hello"...
afontaine's user avatar
  • 311
8 votes
2 answers
5k views

How can I build vim with just python 3 support?

I'm on Arch, and recently the vim-python3 and gvim-python3 packages were removed, so I'm working on building vim from source such that the :python command will act as python3. Specifically, I'm doing ...
Davis Yoshida's user avatar
3 votes
1 answer
534 views

Neovim Python script hangs

I'm thinking of migrating from Vim to NeoVim. I decided to begin with a bit of Python code in my .vimrc that sets the backup directory. Using the documentation, I wrote the following script: "-------...
art-solopov's user avatar
2 votes
2 answers
1k views

Vimscript-python support not working in terminal

When starting vim in a mingw64 terminal emulator on windows, the command :py print(1) fails, saying Could not load library msys-python2.7.dll Sorry, this command is disabled, the Python library could ...
chtenb's user avatar
  • 213
3 votes
1 answer
695 views

How to detect the buffer number of new buffer?

I would like to create a new scratch buffer in vim script. I would like to use this buffer to output the result of the execution of a scala script. I am creating the buffer with this function: ...
Giuseppe Pes's user avatar
1 vote
0 answers
232 views

Is it possible to start python thread from inside Vim under HP-UX?

I've compiled Python 2.7.10 and Vim 7.4 with Python support (HP-UX 11.31 ia64). Everything seems to be working well except for threads. Here's simple example. from threading import Thread from time ...
notdoneyet's user avatar
5 votes
4 answers
866 views

Calculating with python and appending result to file or register

I found this vim tip which allows you to evaluate a Python expression and displays the result in the command line. You just have to add :command! -nargs=+ Calc :py print <args> :py from math ...
Peter's user avatar
  • 217
3 votes
0 answers
208 views

What is the best way to embed external python modules to vim plugin?

I decided to write a plugin for vim. I want to write it mainly in python, as I am most proficient in it. I started development with this example: http://brainacle.com/how-to-write-vim-plugins-with-...
Nebril's user avatar
  • 3,447
11 votes
2 answers
2k views

How to execute python statement for each line?

I've the following sample code which modifies the current line using Python statement: :py import vim; vim.current.line="["+vim.current.line+"]" How I can execute this statement for each line in the ...
kenorb's user avatar
  • 18.5k