在CentOS7上安裝配置vim8.1,打造一個適合開發的編輯環境。
一、准備工作
1. 安裝dircolors:
git clone https://github.com/seebi/dircolors-solarized.git
cd dircolors-solarized/
mv dircolors.ansi-dark ~/.dircolors
在bash_profile中添加:
export TERM=xterm-256color
if [ -x /usr/bin/dircolors ]; then
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias tree='tree -C'
fi
重新登錄后,生效。

2. 安裝依賴:
yum install libXt-devel gtk2-devel
yum -y install python-devel ruby ruby-devel perl perl-devel perl-ExtUtils-Embed
yum install ncurses-devel
yum install ctags
需要依賴python3:
下載Python-3.8.0b1
tar -zxv -f Python-3.8.0b1
cd Python-3.8.0b1
./configure --prefix=/usr/local/python3 --with-ssl
make
sudo make install
3. 關閉SELinux
修改/etc/selinux/config 文件
將SELINUX=enforcing改為SELINUX=disabled
重啟機器。
二、安裝vim8.1
指定python config路徑
--with-python3-config-dir 指定python3 config路徑

三、安裝vim插件
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/phd'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'derekwyatt/vim-fswitch'
Plugin 'vim-scripts/a.vim'
Plugin 'kshenoy/vim-signature'
Plugin 'vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines'
Plugin 'majutsushi/tagbar'
Plugin 'vim-scripts/indexer.tar.gz'
Plugin 'vim-scripts/DfrankUtil'
Plugin 'vim-scripts/vimprj'
Plugin 'dyng/ctrlsf.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-scripts/DrawIt'
Plugin 'SirVer/ultisnips'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
Plugin 'derekwyatt/vim-protodef'
Plugin 'scrooloose/nerdtree'
Plugin 'gcmt/wildfire.vim'
Plugin 'sjl/gundo.vim'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'suan/vim-instant-markdown'
Plugin 'qpkorr/vim-bufkill'
Plugin 'skywind3000/asyncrun.vim'
1. 安裝vundle



2. 安裝YouCompleteMe
1) 安裝cmake
wget https://cmake.org/files/v3.9/cmake-3.9.1.tar.gz
2) 安裝YouCompleteMe
cd .vim/bundle/YouCompleteMe
修改install.sh中PYTHON_BINARY為python,注釋掉python2判斷即可。
./install.sh --clang-completer --system-libclang
安裝完成后,打開vim會顯示python import ycm_core 找不到libclang.so.3.9
復制一份.ycm_extra_conf.py到用戶目錄下:
cp YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/
.ycm_extra_conf.py是YCM的配置文件,可以根據自己的項目情況進行配置。
也可以使用YCM-Generator插件,根據項目去生成:
./config_gen.py PROJECT_DIRECTORY
或在vim中使用:YcmGenerateConfig
詳細用法請查看YCM-Generator文檔。

現在,vim8.1就安裝配置完成了。上幾張安裝后的圖:
--with-python-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ 指定python3 config路徑
