How to compile vim for use with pyenv and vim-pyenv

e · l · n
Aug 20, 2015

I use pyenv for managing custom python installations on the UPPMAX HPC cluster, and since I use vim with jedi-vim for auto-completion in python, I tried to get vim-pyenv to work.

It turned out that the system version of VIM on UPPMAX was outdated though (7.2 rather than the required 7.3+, or 7.4 as is the current version).

This manifested itself in a bunch of error message from the python module in vim, ending with:

AttributeError: 'module' object has no attribute 'vars'

I first thought it was an error in vim-pyenv and reported it (see that issue for more in-depth details). In summary it turns out that older versions of VIM indeed lack some attributes in its python module, so I figured I had to compile my own version, below are just my notes about how to do this, for future reference:

# Go to home directory
cd
mkdir src
cd src
# Download and unpack
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -jxvf vim-7.4.tar.bz2
# Configure
cd vim74
./configure --disable-gui --enable-pythoninterp --prefix=$HOME
# Compile
make
# Install
make install
# Make sure the bin folder in your home folder is in your PATH
echo 'export PATH="~/bin:$PATH"' >> ~/.bashrc

Now you should have a shiny new VIM 7.4, in which you can install the above mentioned plugins!

The main important thing here is to use a recent verison of VIM, and compile it with python support (thus the --enable-pythoninterp flag). The --disable-gui is just since I only use vim in the terminal any way, so I'd rather have VIM start faster, than supporting a GUI that I don't use.