在ubuntu 16.04上面安裝YouCompleteMe插件
vim版本:8.0[需要python支援] cmake libclang3.9+ [需要自己去llvm官網下載下傳預編譯好的二進制檔案,添加到PATH路徑的檔案夾下面]
1.使用Vundle來安裝:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
在vimrc檔案裡面安裝想要的插件:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on
打開vim,輸入:PluginInstall [需要很長時間]
2. 安裝:
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
cd ~/.vim/bundle/YouCompeteme
./install.py --clang-completer
3.如果上一步安裝失敗的話,需要自己編譯,具體點這裡
4.把.ycm_extra_conf.py 複制到your/path/to/.ycm_extra_conf.py
5.幾個重要的option[ycm配置]
let g:ycm_global_ycm_extra_conf = 'Your/path/to/.ycm_extra_conf.py ’
指定ycm的配置檔案。
let g:ycm_seed_identifiers_with_syntax = 1
自動根據文法收集關鍵詞
let g:ycm_add_preview_to_completeopt = 0
關閉函數原型提示
let g:ycm_show_diagnostics_ui = 0
關閉錯誤提示
let g:ycm_semantic_triggers = {}
ycm預設需要按ctrl + space 來進行補全,可以在上面的花括号裡面加入下面兩行代碼來直接進行補全[不需要按鍵]
let g:ycm_semantic_triggers = {
\ 'c,cpp,python,java,go,erlang,perl':['re!\w{2}'],
\ 'cs,lua,javascript':['re!\w{2}'],
\}