Vim 8 was announced in September 2016 and I have decided to compile it from the source. The default config does not include Python support and some of my plugins require this.

The most thorough guide I have found is in the Wiki for the Vim plugin YouCompleteMe. However, I had to make a few tweaks to make it work.

Compilation

First off, clone the Vim repository with

git clone https://github.com/vim/vim.git

In the cloned directory the installation setup is managed with the configure script. To enable Python support the “Python config dir” is needed. On one computer,

$ which python
/usr/bin/python 

and the “config” dir is /usr/lib/python2.7/config-x86_64-linux-gnu. On another computer where the Anaconda distribution is used,

$ which python
/usr/local/anaconda/bin/python

and the “config” dir is /usr/local/anaconda/lib/python2.7/config.

On the Linux Mint distribution I end up with the following options:

./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp=yes \
            --enable-pythoninterp=yes \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
            --enable-python3interp=yes \
            --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \
            --enable-perlinterp=yes \
            --enable-luainterp=yes \
            --disable-gui \
            --enable-cscope \
            --prefix=/usr/local

The “prefix” option is explained by ./configure --help:

By default, make install will install all the files in /usr/local/bin, /usr/local/lib etc. You can specify an installation prefix other than /usr/local using --prefix, for instance --prefix=$HOME.

So my --prefix is actually superfluous, but I keep it here for reference.

After the configure script has completed the actual compilation can commence. I did this in two steps:

make
sudo make install

The make install copies the binary to $PREFIX/bin and the runtime dir to $PREFIX/share/vim/vim80 (and probably other things).

To verify that the desired features are enabled, run vim --version and make sure there is a “+” in front of these features.

VIMRUNTIMEDIR

On YouCompleteMe’s Wiki it is mentioned that the VIMRUNTIMEDIR should be set in the first make.

As a side note, VIMRUNTIMEDIR is the directory Vim use for a lot of run time configuration like syntax highlighting as explained e.g. here.

It worked for me to perform the first compilation with

make VIMRUNTIMEDIR=/home/robert/vim/runtime
sudo make install

But it also turned out to be unnecesarry. When running make install a large part of the output consists of copying the runtime directory to /usr/local/share/....