Building Vim 8 on Ubuntu

Many systems ship with a version of Vim that is outdated or that was compiled with some features disabled.

I needed a Vim with the terminal feature and the system clipboard enabled.

Also I wanted Vim to have the minimum dependencies possible (that means, not installing languages support e.g: Ruby, Python, Perl, etc).

Unfortunately the only way I found to compile Vim with +clipboard was to build it with X11 support.

(Note: this was tested on Ubuntu 16.04.6)

# Remove Vim if you have it already
sudo apt remove vim vim-runtime gvim

# Update
sudo apt update

# Install X11 libraries
sudo apt install libx11-dev libxpm-dev libxt-dev

VIM_VERSION=8.1.1137

# Download Vim release and untar it
wget -qO- https://github.com/vim/vim/archive/v$VIM_VERSION.tar.gz | tar -xz

cd vim-$VIM_VERSION
./configure --with-features=huge --enable-multibyte --with-x

# Compile
make

# Install
sudo make install

# Set Vim as your default editor with update-alternatives
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi /usr/local/bin/vim

And that's it!