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.gitconfigure script.
To enable Python support the “Python config dir” is needed, which is returned from the command python-config --configdir.
On one computer,
$ which python
/usr/bin/python /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/usr/local/anaconda/lib/python2.7/config.
You cannot use both Python 2 and Python 3, so I go for Python 3.
On the Linux Mint distribution I end up with the following options:
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-fail-if-missing \
--disable-gui \
--enable-cscope \
--prefix=/usr/localThe option --enable-fail-if-missing causes the configure command to stop if any of the other options are not available instead of just printing a small notification.
The “prefix” option is explained by ./configure --help:
By default,
make installwill install all the files in/usr/local/bin,/usr/local/libetc. You can specify an installation prefix other than/usr/localusing--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 installThe 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 installmake install a large part of the output consists of copying the runtime directory to /usr/local/share/....
>> Home