Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
0answers
16 views

Vim shows error when running python3

OS: Ubuntu 18.04 First, I ran apt-get install python3-dev ruby-dev Then, I installed vim using the instructions in the website, using make distclean, make and make install (This was like the tenth ...
1
vote
0answers
22 views

How to use visual mode in python/dyn?

Vim documentation states how to run command and normal mode commands (source): vim.command(str) python-command Executes the vim (ex-mode) command str. ...
1
vote
0answers
13 views

Where could I find documentation of python/dyn or python3/dyn?

I guess that :py command is executed by some kind of extended Python interpreter. This extended Python has vim package available: :py import vim; print(dir(vim)); print(vim.__package__, vim.__name__) ...
1
vote
1answer
44 views

Creating a hidden buffer

I know that with commands like sbuffer you can create a new buffer and display it in a split window, and commands like enew can create a new buffer in the current window. But is it possible to not ...
1
vote
0answers
33 views

Why does vim work if command file is double clicked, but not from DOS?

(Windows7-64bits-Vim8.1) I have a problem with getting the python in Vim to work. This problem is probably caused because I do not have admin access to the machine; I can't help that. In order to ...
3
votes
1answer
40 views

Return <motion> character from Python function in <expr> mapping

I am trying to return this :GrepperAck ''<Left> from a Python function and use it in the following mapping def invoke_search_command(): return ":GrepperAck ''<Left>" :nnoremap <expr&...
0
votes
0answers
43 views

Vim using wrong executable and site packages in Python venv

Issue I am using Vim within an activated Python virtual environment i.e. I have run python3 -m pip venv env . env/bin/activate However when I am editing a Python file, then Ale is complaining about ...
0
votes
1answer
103 views

Why is Vim's Python version compiled in?

My machines have Python 3.7 installed. On my Ubuntu machine I have no issues, but on my Windows 10 machine, I can't run Python plugins in Vim. The reason is that the Windows Vim as distributed has ...
-1
votes
1answer
179 views

How do I configure the python location?

The python I want to use is located at C:\randomplace\python. I have a dev machine that has multiple instances of python (so relying on finding python in$PATH is unreliable). How do I configure vim ...
2
votes
1answer
908 views

Installing or building vim with +python3 support for Python 3.7.x on linux

I've got Vim installed on MacOS using Brew and it installs with +python3 support for Python 3.7.2 by default. I'm writing a Vim plugin which utilises some Python 3.7 and would like this to be able to ...
0
votes
1answer
73 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 ...
0
votes
1answer
48 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 ...
0
votes
1answer
2k 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 ...
1
vote
0answers
136 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('./...
3
votes
4answers
174 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\(....
3
votes
1answer
424 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 <bugzilla@redhat.com&...
0
votes
0answers
27 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 ...
0
votes
1answer
39 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 ...
1
vote
1answer
45 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 ...
0
votes
2answers
424 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 ...
1
vote
0answers
66 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 ...
0
votes
1answer
370 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 ...
8
votes
2answers
636 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 ...
7
votes
1answer
2k 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 ...
5
votes
1answer
279 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 ...
1
vote
1answer
67 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 ...
0
votes
1answer
100 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 ...
1
vote
1answer
100 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 ...
0
votes
1answer
458 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/...
0
votes
1answer
292 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 ...
1
vote
1answer
98 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. ...
2
votes
1answer
566 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....
3
votes
1answer
717 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: ...
2
votes
1answer
138 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 ...
6
votes
1answer
5k 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('...
10
votes
3answers
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 ...
22
votes
7answers
25k 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 ...
0
votes
1answer
401 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 ...
1
vote
2answers
576 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 ...
10
votes
6answers
8k 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 ...
0
votes
1answer
2k 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 ...
1
vote
0answers
589 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 ...
0
votes
1answer
134 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 ...
5
votes
1answer
269 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): ...
4
votes
1answer
311 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....
2
votes
1answer
491 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)] ...
5
votes
1answer
1k 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.
2
votes
2answers
679 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....
4
votes
1answer
4k 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 ...
4
votes
3answers
2k 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 ...