1. install VIM plugin management Vundlelinux
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Put this at the top of ~/.vimrc filegit
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' 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
2.Install pathogengithub
mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
將下面代碼添加到.vimrcvim
execute pathogen#infect() syntax on filetype plugin indent on
3. install code auto complete plugin YouCompleteMe 測試發現經過Vundle安裝YouCompleteMe不成功,只能經過下面手工方法安裝此插件windows
cd ~/.vim/bundle git clone https://github.com/Valloric/YouCompleteMe.git cd YouCompleteMe git submodule update --init --recursive ./install.py --clang-completer --system-libclang cd ~/.vim/ wget https://github.com/Valloric/ycmd/blob/master/cpp/ycm/.ycm_extra_conf.py
將下面配置放到.vimrc 後面bash
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的效果。app
四、總結curl
要打造一款合適的vim工具仍是挺囉嗦的,如無必要,最好仍是用IDE,不要浪費時間在上面!這裏個有連接推薦的IDE,通常windows平臺用visual studio,Linux或Mac OS用IDEA。ide
參考:工具
http://www.alexeyshmalko.com/2014/youcompleteme-ultimate-autocomplete-plugin-for-vim/