1. install VIM plugin management
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Put this at the top of ~/.vimrc file
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 'VundleVim/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
2.Install
mkdir -p ~/.vim/autoload ~/.vim/bundle && \curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
将下面代码添加到.vimrc
execute pathogen#infect()syntax onfiletype plugin indent on
3. install code auto complete plugin 测试发现通过Vundle安装YouCompleteMe不成功,只能通过下面手工方法安装此插件
cd ~/.vim/bundlegit clone https://github.com/Valloric/YouCompleteMe.gitcd YouCompleteMegit submodule update --init --recursive./install.py --clang-completer --system-libclangcd ~/.vim/wget https://github.com/Valloric/ycmd/blob/master/cpp/ycm/.ycm_extra_conf.py
将下面配置放到.vimrc 后面
let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"let g:ycm_key_list_select_completion=[]let g:ycm_key_list_previous_completion=[]
编辑一个.c文件查看YouCompleteMe的效果。
4、总结
要打造一款合适的vim工具还是挺啰嗦的,如无必要,最好还是用IDE,不要浪费时间在上面!这里个有链接,一般windows平台用visual studio,Linux或Mac OS用IDEA。
参考: