Compiling Vim from Source

This tutorial is aimed as an aid for my future self, when I'm compiling Vim on my Arch Linux boxes; so it's targeting Arch Linux as a platform, but should work on different distros with minor modifications.

Update

I'm back to Neovim, because it's so simple and convenient to have an editor like Vim that just works out of the box, with everything I need and pretty sane defaults. Sadly Vim cannot deliver the same experience as of now.

Anyway, for those who still want to go through the hoops of compiling Vim with all features, here you go:

cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure \
    --with-features=huge \
    --with-x \
    --with-compiledby=Walialu \
    --enable-multibyte \
    --enable-rubyinterp=yes \
    --enable-pythoninterp=yes \
    --enable-python3interp=yes \
    --enable-perlinterp=yes \
    --enable-luainterp=yes \
    --enable-gui=gtk2 \
    --enable-cscope \
    --enable-gui=auto
make && sudo make install

On Ubuntu 16.04, Python support was not working due to enabling both Python2 and Python3. Read answer by chirinosky for workaround.

I had a similar issue on my Debian box. If you're using a Debian-based system, you will not be able to load both Python libraries simultaneously. That's why when you set --enable-python-interp and --enable-python3-interp they always load with the /dyn suffix.

If your vim plugins don't need both versions, you should just pick one of the versions and stick with it. The links below provide more info.

Explained by Debian maintainer

Vim Python Support

P.S. - In case you tried this on Windows as well, loading either Python version > will work, so the /dyn isn't an issue there.

chirinosky

In practice, Python2 and Python3 are not working at the same time on Ubuntu 14.04.5 LTS. Choosing one of them is OK.

cd ~/vim
sudo checkinstall

Double check that you are in fact running the new Vim binary by looking at the output of vim --version.

If you have problems, double check that you configured using the correct Python config directory, as noted at the beginning of Step 3.

These configure and make calls assume a Arch-based distro. The values may need to be different with a Linux distro that is not based on Arch.