Saturday, 14 May 2016

Building Vim 7.4 from source on Fedora 23

Recently, I switched from Ubuntu 16.04 to Fedora 23, because Ubuntu dropped support for the fglrx driver which I needed to have a functional dual monitor setup with my laptop. I use a moderately customized version of (g)Vim for my text editing and programming needs and I always build the latest version from source. Building Vim from source on Fedora 23 was somewhat more difficult compared to the process on Ubuntu, but here is how to do it. This is based on the excellent tutorial from the YouCompleteMe wiki which I had to modify somewhat for Fedora.

First, we need to install all the dependencies for building Vim from source:
Then, we need to create a symlink (as per the instruction from the YouCompleteMe wiki):

Next, clone the Vim source code and change to the directory containing the source code:

Now we can issue the configure command:

The CFLAGS=-fPIC and --with-tlib=ncurses are to prevent the following "no terminal library found" error (source):

The CFLAGS=-O is to prevent the following "_FORTIFY_SOURCE" warning:

The CFLAGS=-Wformat is to prevent the following "-Wformat-security" error:

Note that you should adjust this command to your needs. I have enabled (amongst others) Python support and gVim. After configuring we can use make to compile:

Now install Vim system-wide:

And set it as the default editor:

I hope this will be useful to you. Enjoy your custom built Vim!