囧囧有神的兔纸

「进修中的」前端攻城湿

© 囧囧有神的兔纸 | Powered by LOFTER

(mac)vim安装自动补全插件:YouCompleteMe

关于 YouCompleteMe 我就不过多介绍了,而且看到这篇文章的各位,相比也是知道这是做什么用的。那么直接来正文吧,我安装这插件的步骤:

安装准备

1. vim 当然是必须的了。而且 YouCompleteMe 对 vim 的版本也有要求,可以试着先往下进行,vim 版本过低的话,可以回过头来单独对付 vim 版本问题。(这里给各位个传送门,安装最新版本 vim:https://andy0620.lofter.com/post/1d56618a_7dc0a79

2. cmake。

  • 可以通过 brew 来安装:

brew install cmake

  • linux的话,自然就是:

sudo apt-get install cmake

3. 安装vundle插件,用于安装管理vim的插件(没有相应目录的当然要 mkdir一个,不再赘述):

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

开始安装:

1. 在 ~/.vimrc 中添加:

setrtp+=~/.vim/bundle/vundle/                                                                                                                                                   

call vundle#rc()                                                                                                                                                                 

Bundle 'Valloric/YouCompleteMe'                                                                                                                                                  

filetype plugin indent on

2. 下载 YouCompleteMe(不建议用 :BundleInstall 的方式来安装,一来这个插件很大,各位绝大部分也是通过翻墙来继续的,很容易断;二来这种方式看不到进度条之类的东西,让你根本不知道已经什么进度了。):

git clone --recursive https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe/

3. 编译:

mkdir ~/ycm_build

cd ~/ycm_build

cmake -G “Unix Makefiles” -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/cpp make ycm_support_libs

4. 安装:

cd ~/.vim/bundle/YouCompleteMe

./install.sh

大功告成!


参考文章:

https://blog.jobbole.com/58978/

评论
热度 ( 5 )