背景
YouCompleteMe 是一个vim的插件组合包,包含了vSyntastic,jedi等众多插件。
安装
YouCompleteMe 依赖于 vim >7.3.584 ,clang >3.2
在centos6.4中clang版本较低,所以需要源码编译安装。
可以参考下面的文章
安装YouCompleteMe 需要vundle 插件的支持。
- 首先需要安装vundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
在/etc/vimrc中添加
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on
上面的配置主要是将vundle进行了配置,以及配置了YouCompleteMe让vundle来进行管理
- 从git库中下载YouCompleteMe的代码
git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
需要对YouCompleteMe 进行编译,编译步骤如下
cd ~
mkdir ycm_build
cd ycm_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/.vim/bundle/YouCompleteMe/cpp/llvm . ~/.vim/bundle/YouCompleteMe/cpp
make ycm_core
mkdir ycm_build
cd ycm_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/.vim/bundle/YouCompleteMe/cpp/llvm . ~/.vim/bundle/YouCompleteMe/cpp
make ycm_core
make ycm_support_libs
这样就安装完成了
- 在/etc/vimrc中 配置一下YouCompleteMe使其生效
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'
现在就可以开始体验YouCompleteMe