Andrew Kennedy

Adding Python Support for Vim

April 10, 2014

tl;dr ./configure –enable-pythoninterp –with-features=huge


I was recently looking into a friend of mine’s clojure project. To get up and running I installed leiningen and vim-fireplace on my arch dev virtual machine. I used lein repl to start a repl (a Clojure interpreter) and opened vim with vim-fireplace installed to take the clojure code I had open and send it off to the repl for evaluation. Unfortunately I ran into an error while opening vim that looked something like this:

nREPL: unexpected end of bencode data^@

After looking through the issues for vim-fireplace on GitHub, I came across this comment by the plugin’s author Tim Pope:

@ywangd it just occurred to me that if you get the Vim Python interface working (such that `:echo has('python')` returns 1), you could sidestep this whole mess and get a better experience to boot. Make sure you have the right architecture of Python installed (32 bit Python unless `:echo has('win64')` is 1) and in you path.

I ran :echo has('python') in vim which returned 0, meaning no python support.

Inorder to fix this I uninstalled vim, downloaded the latest version, configured it to have python support, and installed it.

sudo pacman -R vim
wget ftp://ftp.gr.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar xvf vim-7.4.tar.bz2
cd vim74
./configure --enable-pythoninterp --with-features=huge
make
sudo make install

Wohoo, python support! Now back to messing around with emojis.

Spot a typo? The source of this blog is available on GitHub. Pull requests and issues are welcome. You can also check out this post's revision history.