linux centos7 升级 vim7.4位8.2
1、系统
[root@localhost test]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.9.2009 (Core) Release: 7.9.2009 Codename: Core
2、vim当前版本
[root@localhost test]# vim --version | head VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 15 2020 16:44:08) Included patches: 1-207, 209-629 Modified by <bugzilla@redhat.com> Compiled by <bugzilla@redhat.com> Huge version without GUI. Features included (+) or not (-): +acl +farsi +mouse_netterm +syntax +arabic +file_in_path +mouse_sgr +tag_binary +autocmd +find_in_path -mouse_sysmouse +tag_old_static -balloon_eval +float +mouse_urxvt -tag_any_white -browse +folding +mouse_xterm -tcl
3、卸载vim
[root@localhost test]# yum remove vim -y
4、下载vim8.2安装包及安装
[root@localhost software]# wget https://github.com/vim/vim/archive/v8.2.1862.tar.gz [root@localhost software]# tar -xzvf v8.2.1862.tar.gz [root@localhost software]# mv v8.2.1862.tar.gz vim-8.2.1862/ [root@localhost software]# cd vim-8.2.1862/ [root@localhost vim-8.2.1862]# ./configure --prefix /usr/share/vim/ [root@localhost vim-8.2.1862]# make [root@localhost vim-8.2.1862]# make install
5、测试新版本
[root@localhost bin]# /usr/share/vim/bin/vim --version | head VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 6 2022 20:28:39) Included patches: 1-1862 Compiled by root@localhost.localdomain Huge version without GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary +arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path +mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte +termguicolors -balloon_eval -footer +multi_lang +terminal
6、添加命令别名、环境变量
[root@localhost bin]# echo "alias vim='/usr/share/vim/bin/vim' " >> /etc/bashrc [root@localhost bin]# source /etc/bashrc [root@localhost bin]# vim --version | head VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 6 2022 20:28:39) Included patches: 1-1862 Compiled by root@localhost.localdomain Huge version without GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary +arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path +mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte +termguicolors -balloon_eval -footer +multi_lang +terminal
没有问题。