今天在研究安装YCM插件的时候,遇到了很多问题,其中包括Vim最低要求8.1+版本,服务商提供的源最新只到8.0,所以只能手动安装Vim8.2版本了
1、配置环境
yum install gcc make ncurses ncurses-devel
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
2、下载源码
sudo git clone https://github.com/vim/vim.git
然后切换到目录vim
cd vim
3、编译配置
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-luainterp
按需要进行填写
#configure参数说明:
–with-features=huge:支持最大特性
–enable-rubyinterp:打开对 ruby 编写的插件的支持
–enable-pythoninterp:打开对 python 编写的插件的支持
–enable-python3interp:打开对 python3 编写的插件的支持
–enable-luainterp:打开对 lua 编写的插件的支持
–enable-perlinterp:打开对 perl 编写的插件的支持
–enable-multibyte:打开多字节支持,可以在 Vim 中输入中文
–enable-cscope:打开对 cscope 的支持
–with-python-config-dir=/usr/lib64/python2.7/ 指定 python 路径
–with-python-config-dir=/usr/local/lib/python3.9/ 指定 python3 路径
–prefix=/usr/local/vim:指定VIM将要安装到的路径 (自行创建)
4、编译
make
5、安装
make install
这个过程中如果出现问题了,先检查一下环境是否安装好了
然后make clean,make disctclean清除配置重新make进行编译
这里说一个我遇到的错误
checking for tgetent in -lcurses... no
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.
先检查ncurses-devel已经安装好了,但仍然报错,配置失败
ncurses not found when trying to build vim - Stack Overflow
这里有一个帖子,按帖子里的操作
修改配置如下
CFLAGS=-fPIC ./configure --with-tlib=ncurses and your_options