centos7 vim8.0 编译安装

安装依赖环境

最好使用yum安装,如果没有可以下载源码编译安装

1
sudo yum install -y ruby ruby-devel lua lua-devel luajit luajit-devel ctags git python python-devel python3 python3-devel tcl-devel perl perl-devel perl-ExtUtils-ParseXS perl-ExtUtils-XSpp perl-ExtUtils-CBuilder perl-ExtUtils-Embed gcc

编译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--with-ruby-command=/usr/bin/ruby \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr \
--enable-python3interp=yes \
--with-python3-config-dir=/usr \
--enable-perlinterp=yes \
--enable-fontset \
--enable-luainterp=yes \
--enable-gui=auto \
--enable-gnome-check \
--with-x \
--enable-cscope \
--prefix=/usr/local/vim80

支持python、lua

完成后

1
2
make
sudo make install

如果有旧版本的将其备份,最好别删

1
2
3
sudo mv /usr/bin/vim /usr/bin/vim7.4
sudo ln -s /usr/local/vim80/bin/vim /usr/bin/vim
vim --version

问题

requires Vim compiled with Python (2.6+ or 3.3+) support

当同时存在python2和python3时会出现这种问题,去除编译命令中的python2或python3即可, 例如去除python2后的编译命令如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--with-ruby-command=/usr/bin/ruby \
--enable-python3interp=yes \
--with-python3-config-dir=/usr \
--enable-perlinterp=yes \
--enable-fontset \
--enable-luainterp=yes \
--enable-gui=auto \
--enable-gnome-check \
--with-x \
--enable-cscope \
--prefix=/usr/local/vim80