• Last Updated: 10/23/17
  • OS: Ubuntu 16.04

I ran into some issues while attempting to install the Atom One Dark theme for vim. The vim currently available in apt-get on 16.04 is 7.4.1689, a version predating the addition of 24-bit color to vim. 24-bit color is a requirement for the theme, so it was time to get a newer version of vim.

Note: your terminal emulator needs to support 24-bit 'truecolor' as well as vim. Mosh doesn't support 24-bit color, but regular ssh does.

Check your vim version:

$ vim --version

Vim version must be > 7.4.1770.

There is a pkg-vim/vim-daily ppa, but as of 8/23/16, this is broken:

$ sudo add-apt-repository ppa:pkg-vim/vim-daily
$ sudo apt-get update
$ sudo apt-get install vim

If you do try this, you can remove the broken ppa with:

$ sudo add-apt-repository -r ppa:pkg-vim/vim-daily

We'll go ahead and compile vim from source.

Compile vim on Ubuntu 16.04

First, remove any existing vim installs:

$ sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common

You will need ruby installed if you want to enable the ruby interpreter. You can either remove the --enable-rubyinterp from the ./configure line below, or install ruby. You can use a package manager (like rbenv or rvm), but I just installed from source.

Get vim:

# Clone the source
$ git clone https://github.com/vim/vim.git ~/vimsrc
$ cd ~/vimsrc/src

Install dependencies (Lua and vim-nox are needed for neocomplete):

$ sudo apt-get install build-essential libncurses5-dev libncursesw5-dev liblua5.1-dev luajit libluajit-5.1 vim-nox ruby-dev python-dev


$ ./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-luainterp --enable-largefile --with-luajit --enable-fail-if-missing
$ make -j"$(nproc)"
$ sudo make install

Enable 24-bit color in your ~/.vimrc:

set termguicolors

Now you can use 24-bit color in vim and install themes like onedark.vim.