Vim安装记录



Vim安装记录



参考链接

Building Vim from source
centos6.7 升级vim8


安装命令

1. 安装依赖库

sudo yum install -y ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python3 python3-devel tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed

2. 下载最新vim源码

git clone https://github.com/vim/vim.git
cd vim

3. 删除旧版vim

sudo yum -y remove vim
sudo yum -y remove gvim

4. 配置configure、编译、安装

make distclean

./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/local/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=auto \
--enable-cscope \
--prefix=/usr/local/vim8

make VIMRUNTIMEDIR=/usr/local/vim8/share/vim/vim82

make install

部分参数说明如下:

参数命令 说明
--prefix=/usr/local/software/vim 编译安装路径(你可以自定义)
--with-features=huge 支持最大特性
-enable-gui= auto 表示生成gvim
--enable-multibyte 启用多字节支持,即可以在Vim中输入中文
--enable-fontset 启用对X 字体集输出的支持
--enable-rubyinterp=yes 启用Vim对ruby编写的插件的支持
--enable-pythoninterp=yes 启用Vim对python编写的插件的支持
--enable-perlinterp=yes 启用Vim对perl编写的插件的支持
--enable-luainterp=yes 启用Vim对lua编写的插件的支持
--enable-tclinterp 启用Vim对tcl编写的插件的支持
--enable-cscope Vim对cscope支持

注意有的—enable-XXX选项后需要加yes

如要查看其它未使用参数的说明,用如下的命令:

./configure --help

5. 设置vim为默认编辑器

sudo update-alternatives --install /usr/bin/editor editor /usr/local/vim8/bin/vim 1
sudo update-alternatives --set                     editor /usr/local/vim8/bin/vim
sudo update-alternatives --install /usr/bin/vi     vi     /usr/local/vim8/bin/vim 1
sudo update-alternatives --set                     vi     /usr/local/vim8/bin/vim

6. 必要的配置

backspace可能无法有些字符删除,在 ~/.vimrc 中需要加入如下语句:

"-------------------- 兼容 -----------------------
"不兼容VI,使用VIM的新特性
set nocompatible
set backspace=indent,eol,start
posted @ 2020-10-24 13:28  纟彖氵戋  阅读(148)  评论(0编辑  收藏  举报