因爲要使用vim寫代碼,但是vim沒有自動提示補全功能啊,沒辦法,只有去下載插件了,在網上找了下,大家都覺得youcompleteme不錯,我也就試了下,結果坑到吐血。
因爲項目要用python2寫,而youcompleteme2020年就不支持python2了,不過還好,保留了支持python2的分支legacy py2
話不多說,寫個博客記錄坑
首先,vim的版本最好8+,支持+python
如果不是,且需要安裝python3的可以不用往下看了
我是使用vim-plug安裝的,下面說說我的步驟:
1.在.vimrc中添加
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
然後執行:PlugInstall
2.進入cd .vim/plugged/YouCompleteMe
依次執行
git fetch origin
git checkout legacy-py2
git submodule update --init --recursive
3.執行python install.py,如果報沒有cmake的錯誤,請執行yum install cmake
4.現在打開python文件,就有提示功能了