Python

Published: Wednesday, Dec 26, 2007 Last modified: Saturday, Mar 23, 2024

Firstly:

apt-get install vim-python

for Vi IMproved, with python scripting support hello.py:

import vim

count = 0

for b in vim.buffers:
     print "Length of buffer %s: %s" % (count, len(b))
     count = count + 1

vim.command("help python")

In vim:

:pyfile hello.py

Or you could just run command after command, like:

:python import vim

Er, check the docs

:help python