您的位置首页百科问答

YouCompleteMe安装教程

YouCompleteMe安装教程

的有关信息介绍如下:

YouCompleteMe安装教程

YouCompleteMe是vim的一款非常好用的自动补全插件,下面介绍如何安装

安装Vundle插件管理工具

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

在vim的配置文件vimrc里面添加如下内容(vimrc文件位置,命令模式下:echo $VIM)

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 'gmarik/Vundle.vim'

Plugin 'Valloric/YouCompleteMe'

" All of your Plugins must be added before the following line

call vundle#end() " required

filetype plugin indent on " required

" To ignore plugin indent changes, instead use:

"filetype plugin on

"

" Brief help

" :PluginList - lists configured plugins

" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate

" :PluginSearch foo - searches for foo; append `!` to refresh local cache

" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal

"

" see :h vundle for more details or wiki for FAQ

" Put your non-Plugin stuff after this line

注意,需要注释掉vimrc文件中的 runtime!debian.vim

即在此行前加"号

Vundle安装完成后就可以开始安装YouCompleteMe了,配置已经在上述的文件中写好

打开vim,命令行模式下输入 :PluginInstall

然后就可以看到插件正在安装,由于需要下载的文件比较多(主要是下载的比较慢,普通下载速度在10kb左右),需要的时间可能会有些长,一定要耐心等待,比如作者本人就等了三个小时才提示安装完成

安装完成YouCompleteMe以后,需要配置方可真正发挥作用

在 vimrc文件中添加如下内容:

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'

然后重新打开vim即可