Note: I’d advise installing python libraries via virtualenv
Here’s a 60 second guide to getting it running:
Make sure your install of
vim supports clientserver:
[[ -n "`vim --version | grep client`" ]] && echo "Installed" || echo "Not installed"
If it doesn’t, read this post
Once it does, start an instance of
vim in server mode:
vim --servername this_is_our_name
Create a python file with the following contents to talk to it:
import vimrunner s = vimrunner.Server("this_is_our_name") # initialize vim server client = vimrunner.vimrunner.Client(s) client.type("IHelloWorld<esc>");
Run the python file, see the words appear.
client.type() to send raw commands to the
vim instance, but vimrunner-python provides a few useful abstractions.
- client.insert(“Hello World”) – Will insert “Hello World” at the current location and leave you in insert mode
- client.normal(“dd”) – Will send “dd” in normal mode, cutting the current line into a buffer