到Vim官方Github仓库下载目前最新的Vim Release版本
wget https://codeload.github.com/vim/vim/tar.gz/v8.2.1258
$ mv v8.2.1258 vim-v8.2.1258.tar.gz
$ tar -xvzf vim-v8.2.1258.tar.gz
$ cd vim-8.2.1258/
$ ./configure --prefix=$HOME/.local --enable-python3interp=yes && make && make install
在这里可能会遇到 no terminal library found 错误:
no terminal library found
checking for tgetent()… configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with –with-tlib.
解决方法:
# Ubuntu下解决方法:
$ sudo apt install libncurses5-dev
# CentOS 下
$ yum install ncurses-devel.x86_64
# 完成后重新进行这一步,建议删除
利用alias将vim指令定向到刚刚安装的vim8,同时修改.bashrc确保之后一直能生效
alias vim='~/.local/bin/vim'
echo "alias vim='~/.local/bin/vim'" >> ~/.bashrc
vim --version