在deepin上安裝YouCompleteMe
阿新 • • 發佈:2018-05-15
vimrc 工具 extra diag got 詳細 rop auto ict
詳細安裝步驟在github上有,https://github.com/Valloric/YouCompleteMe,我這裏是自己總結的簡化版安裝步驟。
步驟1.安裝Vundle
首先,clone到本地
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
- 把以下內容復制到.vimrc:
-
set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize
- Install Plugins: 打開vim執行
:PluginInstall
或者直接輸入命令sudo vim +PluginInstall +qall
步驟2.安裝工具和cmake
sudo apt-get install build-essential cmake
步驟3.安裝python-dev,python3-dev
sudo apt-get install python-dev python3-dev
步驟4.安裝clang
sudo apt-get install clang
步驟5.編譯
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
- 如果編譯出錯執行:
git submodule update --init --recursive
步驟6.復制以下內容到.vimrc中
"----------------------------" "------ YouCompleteMe -------" "----------------------------" let g:ycm_global_ycm_extra_conf = ‘~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py‘ " YouCompleteMe set runtimepath+=~/.vim/bundle/YouCompleteMe let g:ycm_collect_identifiers_from_tags_files = 1 " 開啟 YCM 基於標簽引擎 let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 註釋與字符串中的內容也用於補全 let g:syntastic_ignore_files=[".*\.py$"] let g:ycm_seed_identifiers_with_syntax = 1 " 語法關鍵字補全 let g:ycm_complete_in_comments = 1 let g:ycm_confirm_extra_conf = 0 let g:ycm_key_list_select_completion = [‘<c-n>‘, ‘<Down>‘] " 映射按鍵, 沒有這個會攔截掉tab, 導致其他插件的tab不能用. let g:ycm_key_list_previous_completion = [‘<c-p>‘, ‘<Up>‘] let g:ycm_complete_in_comments = 1 " 在註釋輸入中也能補全 let g:ycm_complete_in_strings = 1 " 在字符串輸入中也能補全 let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 註釋和字符串中的文字也會被收入補全 let g:ycm_global_ycm_extra_conf=‘~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py‘ let g:ycm_show_diagnostics_ui = 0 " 禁用語法檢查 inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " 回車即選中當前項 nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " 跳轉到定義處 "let g:ycm_min_num_of_chars_for_completion=2 " 從第2個鍵入字符就開始羅列匹配項
步驟7.出現的錯誤
我安裝完以後,出現了以下錯誤:
YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+)
解決辦法:編譯安裝vim8.0,添加python支持
網址:在deepin上安裝YouCompleteMe
在deepin上安裝YouCompleteMe