0. 概述

最近出了一次差,在途中自然有很多需要等待的时候,然后我肯定是拿出电脑出来敲一敲代码了,但是,出去之后发现一个不爽的点就是用 IDE(Goland)需要用鼠标,很不方便。所以,为了解决一下问题,我觉得还是将 VIM 重新捡起来,所以就尝试在 CentOS 7 中升级一下自己的 Vim 到 Vim 8。

1. 删除旧的 Vim

要安装新的,首先还是得把旧的删除掉,不然后面可能会乱:

[[email protected]]# yum list installed | grep –i vim
vim-common.x86_64                     2:7.4.1868-1.el7.centos          @anaconda
vim-enhanced.x86_64                   2:7.4.1868-1.el7.centos          @anaconda
vim-filesystem.x86_64                 2:7.4.1868-1.el7.centos          @anaconda
vim-minimal.x86_64                    2:7.4.1868-1.el7.centos          @anaconda
[[email protected]]# yum remove vim-enhanced vim-common vim-filesystem vim-minimal

2. 安装依赖

[[email protected]]# yum install -y gcc make ncurses ncurses-devel
[[email protected]]# yum install ctags git tcl-devel \
    ruby ruby-devel \
    lua lua-devel \
    luajit luajit-devel \
    python python-devel \
    perl perl-devel \
    perl-ExtUtils-ParseXS \
    perl-ExtUtils-XSpp \
    perl-ExtUtils-CBuilder \
    perl-ExtUtils-Embed

3. 构建 Vim 8

[[email protected]]# git clone https://github.com/vim/vim.git
[[email protected]]# cd vim
[[email protected]]# ./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=no
[[email protected]]# make
[[email protected]]# make install

4. 确认安装

[[email protected]]# vim --version | head -1
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun  2 2020 18:50:01)

5. 其他选择

如果你嫌弃麻烦,那么可以直接通过 RPM 安装:

[[email protected]]# rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
[[email protected]]# rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
[[email protected]]# yum -y remove vim-minimal vim-common vim-enhanced
[[email protected]]# yum -y --enablerepo=gf-plus install vim-enhanced

6. Ref