麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統 > CentOS > 正文

CentOS7 Vim自動補全插件----YouCompleteMe安裝與配置

2024-06-28 13:21:27
字體:
來源:轉載
供稿:網友
CentOS7 Vim自動補全插件----YouCompleteMe安裝與配置

最近剛裝了新系統CentOS7,想要把編碼環境配置一下,使用Vim編寫程序少不了使用自動補全插件,我以前用的是neocomplcache+code_complete+omnicppcomplete。但在網上搜索時,看到了YouCompleteMe,說YCM更好用一些。個人也喜歡新鮮事物,故決定安裝YCM。但安裝過程遇到了不少坑,網上的教程有不同的安裝方法,基本都試遍了。最終在倒騰了一下午的情況下終于弄好了,現在把可行的安裝配置方法貼出來,以供需要的人參考。

YouCompleteMe:一個隨鍵而全的、支持模糊搜索的、高速補全的插件。YCM 由 google 公司搜索項目組的軟件工程師 Strahinja Val Markovic 所開發,YCM 后端調用 libclang(以獲取AST,當然還有其他語言的語義分析庫)、前端由 C++ 開發(以提升補全效 率)、外層由 python 封裝(以成為 vim 插件),它可能是我見過安裝最復雜的 vim 插件了。

要安裝YouCompleteMe ,vim須支持python??词欠裰С?,可以在vim中:version 查看, 如果python前有+號,就是支持,減號就是不支持。

如果不支持,需要以編譯安裝方式重新安裝vim。編譯配置選項:

./configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset

一、安裝vundle插件

步驟一:

[zhupengfei@localhost ~]$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle^C

步驟二: 在.vimrc中配置

[zhupengfei@localhost ~]$ vim .vimrc

set nocompatible              " be iMPRoved, requiredfiletype off                  " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/vundle/call vundle#rc()" alternatively, pass a path where Vundle should install plugins"let path = '~/some/path/here'"call vundle#rc(path)" let Vundle manage Vundle, requiredPlugin 'gmarik/vundle'" The following are examples of different formats supported." Keep Plugin commands between here and filetype plugin indent on." scripts on GitHub reposPlugin 'tpope/vim-fugitive'Plugin 'Lokaltog/vim-easymotion'Plugin 'tpope/vim-rails.git'" 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/'}" scripts from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'Plugin 'FuzzyFinder'" scripts not on GitHubPlugin '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'" ...filetype plugin indent on     " requiredBundle 'Valloric/YouCompleteMe'

步驟三:保存退出,打開vim,輸入 :BundleInstall 進行自動安裝。

進程如下,+號表示已經安裝,>表示正在安裝。

[zhupengfei@localhost ~]$ vim
:BundleInstall 

安裝時有個錯誤,這是正常的,因為ycm需要手動編譯出庫文件。

Done! With errors; press l to view logycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it. Read the docs!

二、安裝配置YouCompleteMe

步驟四: 然后到.vim/bundle/YouCompleteMe 下執行命令:

./install.sh --clang-completer

參數是為了支持c/c++的補全

[zhupengfei@localhost YouCompleteMe]$ ./install.sh --clang-complete

然后可能還會出現報錯:

Some folders in /home/sky-tm/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party are empty; you probably forgot to run: git submodule update --init --recursive

若出現此錯誤,則按照提示來,繼續輸入命令:

git submodule update --init --recursive

[zhupengfei@localhost YouCompleteMe]$git submodule update --init --recursive

等此命令更新完成后,再此執行命令:

./install.sh --clang-completer

[zhupengfei@localhost YouCompleteMe]$ ./install.sh --clang-complete

安裝完成后,進行一些簡單的配置就可以使用了。

YouCompleteMe進行補全時需要查找一個ycm_global_ycm_extra_conf文件??梢悦看卧诠ぷ髂夸浿蟹胖眠@個文件,也可以設置全局。全局設置要在.vimrc中添加一行即可。

注:.ycm_extra_conf.py 是個隱藏文件,路徑在~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py '

關于.vimrc的配置就不貼了,網上有很多,可以根據個人的喜好進行配置。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 999精品久久久 | 黄色av网 | 亚洲精品有限 | 国产1区视频 | 国产污污视频 | 久久999精品久久久 国产噜噜噜噜久久久久久久久 | 视频在线中文字幕 | 免费国产精品视频 | a级在线| 日本a∨精品中文字幕在线 欧美1—12sexvideos | 羞羞色院91精品网站 | 中文字幕www.| 久久久久99999 | 亚洲欧美aⅴ | 午夜精品久久久久久毛片 | 九九热精品在线视频 | 成人在线视频网 | 福利在线国产 | 国产一级毛片国产 | 成人免费看毛片 | 亚洲免费看片网站 | 久久99精品久久久久久国产越南 | 国产成人精品一区二区视频免费 | 4p一女两男做爰在线观看 | 色成人在线 | 中文字幕亚洲一区二区三区 | 国产一区精品在线观看 | 蜜桃欧美性大片免费视频 | 亚洲国产美女视频 | 欧美成人se01短视频在线看 | 中文字幕免费在线看 | 黄色特级一级片 | 成人免费福利视频 | 久久91亚洲精品久久91综合 | 国产精品99久久99久久久二 | 久久精品中文字幕一区二区三区 | 免费一级毛片网站 | 免费高潮在线国 | 国产99久久精品一区二区 | 中文在线观看免费视频 | 免费毛片播放 |