The CentOS yum repositories only have Vim 7.2 available for install, however there are a number of bug fixes and new features in the 7.3+ versions that I like to have available. As such I now generally install Vim from source on a new CentOS box to make sure i have the latest version available.
First off you will need to install the development tools required for compiling from source. My preference is to install the Development tools group on any new box. While you don’t need all the tools installed via this method to compile Vim, depending on what you are doing with the box you may use many of them.
yum groupinstall 'Development tools'
Once this is done, you will need to install a terminal library and its header files. Although ncurses
is almost definitely already installed, Vim complains if you don’t have the headers and while we are installing packages we may as well get this done too.
yum install ncurses ncurses-devel
Next up you need to get the latest version of the Vim source code, unpack it and move into the new directory
cd /usr/local/src
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -xjf vim-7.4.tar.bz2
cd vim74
Now we want to configure the build along with any options we want to add. I include the luainterp
option as I use neocomplete plugin which requires Lua.
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-luainterp
Lastly you need to make the binary and install it.
make && make install
If everything has gone to plan this should mean you have successfully installed Vim 7.4 on your system.
You can check it out by typing vim
at the command line to open the editor then type :version
in the editors normal mode. This will give you something like the following output to confirm you have got the latest version running
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 15 2013 17:59:22)
Compiled by fullybaked
Huge version without GUI. Features included (+) or not (-):