vim配置補全插件YouCompleteMe

系統環境:
Ubuntu 14.04
Vim 7.4.273

1.YouCompleteMe插件需要 Vim 7.4.153 以上的版本,如果vim版本過低請先升級:

add-apt-repository ppa:fcwu-tw/ppa
apt-get update
apt-get install vim

2.安裝Vundle
Vundle是優秀的vim插件管理工具:

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

3.安裝YouCompleteMe
將下面的內容拷貝到~/.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')
" install YouCompleteMe
Bundle 'Valloric/YouCompleteMe'
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" 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

運行vim 在命令模式下輸入如下命令

:PluginInstall

等待安裝
注意:YouCompleteMe包比較大,安裝過程會持續比較長的時間不要中途中斷。
安裝完成後

cd ~/.vim/bundle/YouCompleteMe
./install.py --all

等待下載及編譯過程(時間較長)
完成安裝。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章