Published: Wednesday, Dec 26, 2007 Last modified: Monday, Jul 15, 2024


apt-get install vim-python

for Vi IMproved, with python scripting support

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:


Or you could just run command after command, like:

:python import vim

Er, check the docs

:help python