三四年前我配置vim插件的时候还都是手动配置,还没有听说vundle这个vim插件管理工具,现在配置vim插件的时候基本上都用vundle,这个插件也确实是方便快捷,只不过这东西时能话了就不清楚里面的一些基本原理了,就好像学c语言要学会用命令行一样,用IDE的话会理解不深刻
1.需要需要确认vim支持python
2.sudo dnf install vim git python python-devel gcc gcc-c++ cmake clang
3.git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
4.在vim的配置文件vimrc里面添加如下内容(vimrc文件位置,命令模式下:echo $VIM)
在vim的配置文件vimrc里面添加如下内容(vimrc文件位置,命令模式下:echo $VIM)set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'gmarik/Vundle.vim'Plugin 'Valloric/YouCompleteMe'" All of your Plugins must be added before the following linecall vundle#end() " requiredfiletype 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
5.打开vim,命令行模式下输入 :PluginInstall
6.
进入YoucompleteMe目录,#cd ~/.vim/bundle/YoucompleteMe#./install --clang-completer //PS这里可以使用install --help查看支持哪些补全
7.在.vimrc中添加
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
ok能用了
如果想对ycm进行一些配置的话可以看官方文档https://github.com/Valloric/YouCompleteMe 的option一节