YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vimpython
聽說YouCompleteMe是一個強大的自動補全插件,就試着安裝一下,體驗後確實不錯,但安裝過程也不是一路順風的,總結一下過程,但願下次再用時不要再跳坑嘍。git
首先說下我本身的環境,系統是ubuntu16.04 LTS 64位,VIM版本爲7.4.1689 -python +python3,VIM安裝插件時使用VIM插件管理工具Vundle安裝,假設vim已安裝vundle插件管理工具(安裝vundle也是很簡單的,具體步驟請查看vundle官方說明github
Ensure that your version of Vim is at least 7.4.143 and that it has support for Python 2 or Python 3 scripting.ubuntu
Inside Vim, type :version. Look at the first two to three lines of output; it should say Vi IMproved X.Y, where X.Y is the major version of >vim. If your version is greater than 7.4, then you're all set. If your version is 7.4 then look below that where it says, Included patches: >1-Z, where Z will be some number. That number needs to be 143 or higher.vim
vim --version
, 而後查看第二行,包含補丁:1-Z,其中的Z即爲補丁號vim --version grep python
,若是出現的python或python3前面有+號則知足條件,若是都是-號說明不知足條件,須要本身動手編譯vim源碼或下載7.4以上的版本。:version
,vim命令來查看,還能夠使用:echo has('python') || has('python3')
,vim命令查看知足條件不。sudo apt-get install cmake build-essential python-dev python3-dev
來安裝,其他系統能夠參考YouCompleteMe插件官方說明安裝的步驟仍是很簡單的,關鍵是須要知足前提條件,若是不知足是確定過不去的。。。ide
在~/.vimrc的call vundle#end()以前添加Plugin 'Valloric/YouCompleteMe'
,而後保存,而後執行:source ~/.vimrc
vim命令,而後執行:PluginInstall
vim命令,最後就是等待VIM下載YouCompleteMe工具
下載完成後切換到vundle目錄下的YouCompleteMe,如本機的
而後執行./install.py或./install.sh等待安裝完成ui
安裝完成後新建一個python文件,而後使用vim編輯一下吧,記得使用C-X C-O體驗一下全能補全奧。。。插件
po一張最後的效果圖
code