YouCompleteMe安装教程
1. 安装vundle
Vundle用于vim插件管理软件,安装过程如下:
* 下载Vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
- 设置Vundle
在.vimrc
开头添加如下内容:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
之后运行vim
并且运行:PluginInstall
2. 利用Vundle安装YouCompleteMe
继续在.vimrc
添加如下内容,表示安装YouComplete插件
Plugin 'Valloric/YouCompleteMe'
打开vim
并且运行:PluginInstall
3. 编译YCM
- 需要安装编译工具:
sudo apt-get install build-essential cmake
和Python头文件:
sudo apt-get install python-dev python3-dev
- 编译YCM
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
其中的--clang-completer
表示开启对C系列语言的支持。
此外它还支持Go、JavaScript等,编译选项分别为:--gocode-completer
、--tern-completer
。
或者使用--all
开启全部的选项。