Ubuntu 16.04下编译安装vim/gvim 8.0

date: 2017.12.27; modification:2017.12.27

目录:

1 删除原本的vim包

sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common

或者直接更彻底些: sudo apt-get purge vim-*

2 安装依赖

Vim依赖:
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev libperl-dev libncurses5-dev ruby-dev

gui依赖(如果需要gvim):
sudo apt-get install libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev

// Clean and prepare folders
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim

3 编译安装

git clone https://github.com/vim/vim
cd vim/src
#make distclean 网上抄来的, 但是我没用这一步


./configure --with-features=huge \
            --enable-largefile \
            --enable-multibyte \
            --enable-fail-if-missing \
            \
            --enable-rubyinterp \
            --with-ruby-command=$(which ruby) \
            --enable-pythoninterp \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
            --enable-perlinterp \
            --enable-luainterp \
            --with-luajit \
            --enable-gui=auto --enable-cscope
make
sudo make install

可以安装checkinstall工具将从源码安装的软件变得像用deb包安装的一样, 方便以后可以直接用sudo dpkg -P vim删除vim:

sudo apt-get install checkinstall
cd vim
sudo checkinstall