centOS7下安装vim8.2

发布时间 2023-04-19 14:02:55作者: 童年的回忆

请先安装nodejs

yum安装设置Node.js v16版本
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash
(setup_16里16是版本号,可根据自己需要修改)
yum方式安装
sudo yum -y install nodejs
其它参考:
以上命令安装不成功可执行:
sudo yum clean all
若本地存在多个nodesoucre,可以执行以下命令,在重新yum安装命令
sudo rm -fv /etc/yum.repos.d/nodesource*

 

python3

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

mkdir /usr/local/python3 

tar -xvJf  Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install

ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

 

yarn

#配置yarn官方yum存储库
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo

yum install yarn

yarn -v

 

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

卸载vim

[root@localhost test]# yum remove vim -y

下载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 --enable-pythoninterp --enable-python3interp  --prefix /usr/share/vim/
[root@localhost vim-8.2.1862]# make
[root@localhost vim-8.2.1862]# make install

测试新版本:

[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

添加命令别名、环境变量

[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