Vim extension (via Python)?


is it possible to extend vim functionality via custom extension (preferably, written in Python)?

What I need ideally is custom command when in command mode. E.g.




9/26/2008 11:05:12 AM

Accepted Answer

vim supports scripting in python (and in perl as well, I think).

You just have to make sure that the vim distribution you are using has been compiled with python support.

If you are using a Linux system, you can download the source and then compile it with

./configure --enable-pythoninterp 
sudo make install

Inside vim, you can type


to list the available features; if it has python support, you should see a '+python' somewhere (a '-python' otherwise).

Then, to check the usage of the python module, you can type

:help python

P.S: if you're going to compile the vim sources, make sure to check the available configure options, you might need to specify --with-python-config-dir as well.

P.P.S: to create a "custom command in command mode" (if I understand correctly what you mean), you can create a function "MyFunction" in a vim script (using python or the vim scripting language) and then invoke it with

:Call MyFunction()


:help user-functions

for details

9/26/2008 11:07:58 AM

Yes it is. There are several extensions on

It can be done with python as well if the support for python is compiled in.

Article about it:

Google is our friend.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow