Build Vim from Source
Many times when I want to use vim which comes within the main repo of any Linux distro, I find that it is missing some kind of support, either python or client-server mode, or any other feature. And there for I have to build it manually from source and install it. I documented the resulting setup piece by piece in my vimrc adventure.
In this post, I show the steps to do that on fedora, as it is my current distro. I had to collect the steps from many resources including vimdoc, vim-wiki and many stackoverflow answers and blogs. So I wanted to blog these steps to come back to them anytime I need to build vim from source with:
- Python3 support.
- Ruby support.
- Lua support.
- Perl support.
#!/bin/bash
sudo dnf install ncurses ncurses-devel -y
cd ~
git clone https://github.com/vim/vim.git /tmp/vimsrc
cd /tmp/vimsrc
CFLAGS+="-O -fPIC -Wformat" ./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-python3interp \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=auto --enable-cscope --prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim74
sudo make install
# Show Result
vim --version
In case python-2.7 is needed instead of python3, just replace them in the config lines:
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
Building from source is mostly about reading documentation and fixing whatever breaks next. If you have ever built vim or another stubborn piece of software from source, what part took you the longest, and how did you work through it?