Linux系統(tǒng)Vim編輯器如何安裝YouCompleteMe插件?

編譯配置選項(xiàng):
/configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset
在我的機(jī)器上裝有python2.7.5 和 python3.3, 但加了enable-python3interp參數(shù)依然沒有支持py3,不知何故,先不管,YouCompleteMe 只要求有py2.6以上。
安裝vundle插件
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
在.vimrc中配置
set nocompatible “ be iMproved, required
filetype off ” required
“ set the runtime path to include Vundle and initialize
set 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, required
Plugin ‘gmarik/vundle’
” The following are examples of different formats supported.
“ Keep Plugin commands between here and filetype plugin indent on.
” scripts on GitHub repos
Plugin ‘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.html
Plugin ‘L9’
Plugin ‘FuzzyFinder’
” scripts not on GitHub
Plugin ‘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 “ required
Bundle ‘Valloric/YouCompleteMe’
保存退出,打開vim,輸入 :BundleInstall 進(jìn)行自動(dòng)安裝
進(jìn)程如下,+號表示已經(jīng)安裝,》表示正在安裝
。 Plugin ‘gmarik/vundle’ |~
+ Plugin ‘tpope/vim-fugitive’ |~
+ Plugin ‘Lokaltog/vim-easymotion’ |~
+ Plugin ‘tpope/vim-rails.git’ |~
+ Plugin ‘rstacruz/sparkup’ |~
+ Plugin ‘L9’ |~
+ Plugin ‘FuzzyFinder’ |~
》 Plugin ‘git://git.wincent.com/command-|~
t.git’ |~
Plugin ‘file:///home/gmarik/path/to/pl|~
ugin’ |~
Plugin ‘Valloric/YouCompleteMe’ |~
Helptags
備注:結(jié)束時(shí)有個(gè)錯(cuò)誤,這是正常的,因?yàn)閥cm需要手工編譯出庫文件
Done! With errors; press l to view log
ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need
to compile YCM before using it. Read the docs!
到 .vim/bundle/YouCompleteMe 下
/install.sh --clang-completer
參數(shù)是為了支持c/c++ 的補(bǔ)全。
安裝完成后,進(jìn)行一些簡單的配置就可以使用。
YouCompleteMe 的補(bǔ)全配置文件在/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py,這是個(gè)隱藏文件。
默認(rèn)會(huì)使用這個(gè)文件,也可以把這個(gè)文件copy到工程的根目錄中作修改,打開工程文件時(shí)會(huì)優(yōu)先使用當(dāng)前目錄下的配置文件。
如果找不到,會(huì)根據(jù)配置中的ycm_global_ycm_extra_conf 進(jìn)行查找。
在.vimrc 中添加
let mapleader = ”,“ ” 這個(gè)leader就映射為逗號“,”
let g:ycm_global_ycm_extra_conf = ‘~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py’ “配置默認(rèn)的ycm_extra_conf.py
nnoremap 《leader》jd :YcmCompleter GoToDefinitionElseDeclaration《CR》 “按,jd 會(huì)跳轉(zhuǎn)到定義
let g:ycm_confirm_extra_conf=0 “打開vim時(shí)不再詢問是否加載ycm_extra_conf.py配置
let g:ycm_collect_identifiers_from_tag_files = 1 “使用ctags生成的tags文件
以上就是Linux給Vim安裝YouCompleteMe插件的方法了,YouCompleteMe插件號稱Vim自動(dòng)補(bǔ)全神器,這個(gè)插件對Vim來說相當(dāng)重要。
相關(guān)文章
linux系統(tǒng)下Centos中"vim配置"到底有多強(qiáng)大
當(dāng)我們在linux系統(tǒng)中使用vim編輯器時(shí),總感覺vim編輯器的界面不是太美觀,不能讓用戶使用的舒服,不僅僅頁面設(shè)置不習(xí)慣,沒有顯示的行號,也沒有自動(dòng)的縮進(jìn),頁面的背景也2016-11-22- 本文檔主要講述的是linux的vim編輯器使用詳解;配置文件是Linux系統(tǒng)的顯著特征之一,其作用有點(diǎn)類似于Windows 系統(tǒng)的注冊表,只不過注冊表是集中管理,而配置文件采用了分2016-11-09
- 本文檔主要講述的是Vim編輯器使用手冊;希望對大家的學(xué)習(xí)會(huì)有幫助;感興趣的朋友可以過來看看2016-11-09
學(xué)習(xí)vi和vim編輯器 中文版 第7版pdf格式
將說明使用這兩種程序編輯文檔的基礎(chǔ)技巧,并討論高級工具,例如交互式宏與擴(kuò)展編輯器的腳本——我們的內(nèi)容編寫成容易遵循步驟操作的風(fēng)格,成就本書的經(jīng)典地位2015-10-26Linux在VIM編輯器中修改Tab為4個(gè)空格的方法
使用VIM編輯器為了提高我們的編輯速度,經(jīng)常會(huì)在編輯器中設(shè)置一些快捷方式,在VIM編輯器中設(shè)置Tab鍵為4個(gè)空格的方法,感興趣的朋友不要錯(cuò)過2015-05-21- Vim是從vi發(fā)展出來的一個(gè)文本編輯器。代碼補(bǔ)完、編譯及錯(cuò)誤跳轉(zhuǎn)等方便編程的功能特別豐富,在程序員中被廣泛使用。2013-10-15
vim編輯器中文參考手冊 vim編輯器學(xué)習(xí)指南 PDF高清版
經(jīng)常按書中的指示進(jìn)行示例性的操作, 在學(xué)習(xí)Vim眾多精致的技巧時(shí), 不要貪圖一下子全都掌握, 最好是看一條技巧后, 馬上在編輯器上進(jìn)行操作2012-06-15- spf13-vim是一個(gè)跨平臺和VIM插件和各種資源的Vim,gVim 和MacVim是高度可定制的,它可以在Linux,Windows和MacOS X系統(tǒng)以及其他類Unix系統(tǒng)中,它遵循vim的傳統(tǒng)的感覺,因?yàn)?/div> 2016-12-13
最新評論