目录
Linux chris-166 6.2.0-36-generic #37~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 9 15:34:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- // 源码下载
- chris_166@chris-166:~/Tools/Vim$ git clone https://github.com/vim/vim.git
-
- // 准备vim编译的依赖环境和对Python库的支持
- chris_166@chris-166:~/Tools/Vim$ sudo apt install python3
- chris_166@chris-166:~/Tools/Vim$ sudo apt install python3-dev
- chris_166@chris-166:~/Tools/Vim$ sudo apt-get install libperl-dev
- chris_166@chris-166:~/Tools/Vim$ sudo apt install build-essential python3-dev
- // 支持C的外部lua库和正则表达式
- chris_166@chris-166:~/Tools/Vim$ sudo apt install lua5.3 -y
- chris_166@chris-166:~/Tools/Vim$ sudo apt install liblua5.3-dev -y
- chris_166@chris-166:~/Tools/Vim$ sudo apt install libperl-dev -y
-
- // 进入到vim源码里进行配置
- chris_166@chris-166:~/Tools/Vim/vim$ ./configure \
- --with-features=huge \
- --prefix=/usr/local/vim \
- --with-features=huge \
- --enable-fail-if-missing \
- --enable-luainterp \
- --enable-perlinterp \
- --enable-fontset \
- --enable-python3interp \
- --with-python3-command=python3
-
- // 开始编译安装vim
- chris_166@chris-166:~/Tools/Vim/vim$ sudo make -j8
- chris_166@chris-166:~/Tools/Vim/vim$ sudo make install
1. ./configure xxx执行成功

如果执行./configure报如下错误
checking if compile and link flags for Perl are sane... no: PERL DISABLED configure: error: could not configure perl
尝试如下方法解决
chris_166@chris-166:~/Tools/Vim/vim$ sudo apt update
chris_166@chris-166:~/Tools/Vim/vim$ sudo apt-get install libperl-dev
2. sudo make install

通过上述的"./configure --prefix=/usr/local/vim \"可知其安装目录,接下来进入到"/usr/local/vim"检查下

- chris_166@chris-166:/usr/local/vim$ echo 'export PATH="/usr/local/vim/bin:$PATH"' >> ~/.bashrc

至此vim编译安装完成
