Compile Vim Yourself!

27. November 2017
linux vim fun ubuntu

I looooove Vim. So much, I stopped using any other IDE or text editor. Using it and learning new ways of doing things in vim is a constant process. Copying to the system clipboard is rather clumsy, for example. Of course it's possible with "+y, but only if your vim installation is built with +clipboard option.

Unfortunately this is not the case with even the biggest feature-set available pre-built for Ubuntu. But there is no need to despair! Just compile it youself with everything you need. Even though it might sound complicated, it's only a few commands. Let's start building a vim with all features available:

First we have to install all dependencies. On Ubuntu this can be done with

sudo apt-get install liblua5.1-dev luajit libluajit-5.1 libperl-dev ruby-dev python-dev

It could be possible, that you need to install more packages. We will see when the config fail. Pay attention to the error message and install the needed package.

There is one caveat with the lua interpreter: The header file needs to be in a specific folder. Just issue the following command:

sudo mkdir /usr/include/lua5.1/include
sudo cp /usr/include/lua5.1/*.h /usr/include/lua5.1/include/

After all the dependencies are met, we can start with the fun part. Clone vim and move to the folder:

git clone --depth 1
cd vim

We don't need all the development history, so we clone only the current state of the repository. This saves time and bandwidth. Now we can configure the features we want:

./configure \
    --with-features=huge \
    --enable-rubyinterp \
    --enable-largefile \
    --disable-netbeans \
    --enable-pythoninterp \
    --with-python-config-dir=/usr/lib/python2.7/config \
    --enable-perlinterp \
    --enable-fail-if-missing \
    --enable-cscope \
    --enable-luainterp \
    --with-lua-prefix=/usr/include/lua5.1 \

After a last call to

make -j8
sudo make install

we are done and have a self-compiled vim on our system. You can verify you installation with vim --version. Have fun and don't forget to check for new updates onve in a while. Just git pull in the repository and repeat the last step.