1. 下载 plug.vim 文件,根据操作系统不同,放置在以下 autoload 目录中:
- Linux: ~/.vim/autoload
- Windows: ~\vimfiles\autoload\plug.vim
2. 目录结构如下,之后安装的插件将存放在 plugged 目录中:
3. 在 vimrc 配置文件中增加 plug-vim 部分,示例如下:
call plug#begin('~/.vim/plugged')
" Shorthand notation for plugin
Plug 'foo/bar'
call plug#end()
4. 安装ycm插件
5. cd ~/.vim/bundle/YouCompleteMe/ 进入到 YouCompleteMe 目录,在 terminal 窗口敲入 git submodule update --init --recursive 解决youcompleteme依赖项目.
6. $ ./install.sh --clang-completer 参数–clang-completer 是为了支持 C/C++ 的补全,不需要可以不加。
编译过程比较长,耐心等待。
7. 找到配置文件 .ycm_extra_conf.py
网上大多说这个文件在 YouCompleteMe/cpp/ycm 下面,但是 YouCompleteMe 下面就没有 cpp 文件夹,其实它是在 third_party/ycmd/cpp/ycm 目录下。
$ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/