How to build Vim 7.4 with Lua support on CentOS 7

By   06-25-2016 · 2 minute read · 231 words


If you use Vim on CentOS 7 and use neocomplete for code completion then you’ll probably notice that you’ll receive an error that Lua isn’t available when you try to install the plugin.

Although Vim can be compiled from source to enable Lua support, it’s pretty messy and can probably be better handled with a RPM for better distribution and repeatability.

Thanks to the work from Karsten Hopp, Vim with Lua support was built for Fedora Core 19, however we’re on CentOS 7 and will need to rebuild the source rpm.

Here were the steps I took to re-build the Fedora 19 RPM on CentOS 7.

First install all dependencies you’ll need to rebuild the rpm.

sudo yum -y install git rpm-build python-devel ncurses-devel perl-devel gpm-devel libXpm-devel libXt-devel libSM-devel gtk2-devel desktop-file-utils ruby ruby-devel libselinux-devel autoconf libacl-devel perl-ExtUtils-Embed gcc lua-devel

Next we will create the required rpmbuild environment. Make sure you are building as a non-root user.

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

Pull the Fedora rpm and install it.

wget http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/19/SRPMS/vim-7.4.417-1.fc19.src.rpm
rpm -Uvh vim-7.4.417-1.fc19.src.rpm

From here we just need to build

cd rpmbuild/SPECS
rpmbuild -ba vim.spec 

If all goes well and you don’t receive any errors, you’ll see the built rpm files in rpmbuild/RPMS/x86_64 and will just need to install them.

sudo rpm -Uvh vim-enhanced-7.4.417-1.el7.centos.x86_64.rpm vim-minimal-7.4.417-1.el7.centos.x86_64.rpm vim-common-7.4.417-1.el7.centos.x86_64.rpm vim-filesystem-7.4.417-1.el7.centos.x86_64.rpm

Now we can get code completion magic on CentOS 7.

vim  

comments powered by Disqus