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