我安装遇到的主要问题是不知道vundle有老版和新版之分,以致于rpt设置的新版,git clone 的却是老版,于是就遇到一些诡异的问题了,例如找不到:BuildInstall命令。。。
vundle新版和旧版还是差的比较多的。旧版:vundle#rc()、Bundle;新版:vundle#begin()、Plugin.
网上找到的大部分是老版本的安装方式,如下:
一. Vundle的安装
$ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle 2. 更新.vimrc配置文件
set nocompatible " be iMproved set rtp+=~/.vim/bundle/vundle/ " let Vundle manage Vundle " a) 指定Github中vim-scripts仓库中的插件,直接指定插件名称即可,插件明中的空格使用“-”代替。 “ b) 指定Github中其他用户仓库的插件,使用“用户名/插件名称”的方式指定 Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/vim-easymotion' Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} Bundle 'tpope/vim-rails.git' " c) 指定非Github的Git仓库的插件,需要使用git地址 Bundle 'git://git.wincent.com/command-t.git' Bundle 'file:///Users/gmarik/path/to/plugin' filetype plugin indent on " required!
3. 安装插件,顺便用vim打开一个文件,输入下面命令
:BundleInstall
二.新版安装
1.
Vundle的安装
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
2. 更新.vimrc配置文件(下面是我的.vimrc文件)
" ***************** 全局设置 ************** " set gcr=a:block-blinkon0 "禁止关闭闪烁 set laststatus=2 "总是显示状态栏 "set cursorcolumn "高亮显示当前列 "set backspace=indent,eol,start " *************** 设置全局快捷键 ***************** "let mapleader="\<space>" "nmap <Leader>WQ :wa<CR>:q<CR> nnoremap <Leader>l <C-W>l nnoremap <Leader>h <C-W>h nnoremap <Leader>k <C-W>k nnoremap <Leader>j <C-W>j " ************** 插件管理与设置 ************ " set rtp+=~/.vim/bundle/Vundle.vim " vundle 管理的插件列表必须位于 vundle#begin() 和 vundle#end() 之间 Plugin 'VundleVim/Vundle.vim' Plugin 'Lokaltog/vim-powerline' "status 美化 Plugin 'octol/vim-cpp-enhanced-highlight' "对c++语法高亮增强 Plugin 'kshenoy/vim-signature' "书签可视化的插件 Plugin 'vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines' "书签行高亮 Plugin 'majutsushi/tagbar' "taglist的增强版,查看标签,依赖于ctags Plugin 'scrooloose/nerdcommenter' "多行注释,leader键+cc生成, leader+cu删除注释 Plugin 'scrooloose/nerdtree' "文件浏览 Plugin 'Valloric/YouCompleteMe' "自动补全 Plugin 'kien/ctrlp.vim' "搜索历史打开文件,在命令行模式下按ctrl+p触发 Plugin 'vim-scripts/grep.vim' "在命令行模式使用grep命令,:Grep Plugin 'Lokaltog/vim-easymotion' "快速跳转,按两下leader键和f组合 Plugin 'vim-scripts/ShowTrailingWhitespace.git' "高亮显示行尾的多余空白字符 Plugin 'vim-scripts/indentpython.vim.git' Plugin 'vim-scripts/Solarized.git' "主题方案 Plugin 'nathanaelkane/vim-indent-guides.git' "缩进对齐显示 "Plugin 'vim-scripts/indexer.tar.gz' "自动生成标签 "Plugin 'vim-scripts/DfrankUtil' "indexer 依赖 "Plugin 'vim-scripts/vimprj' "indexer 依赖 Plugin 'davidhalter/jedi-vim' "python 补全,不依赖于tags,但比较慢,可以使用indexer替换,但不能跳转项目外 Plugin 'vim-scripts/Markdown' Plugin 'tpope/vim-surround' Plugin 'ekalinin/Dockerfile.vim' let g:Powerline_colorscheme='solarized256' " 设置 tagbar 子窗口的位置出现在主编辑区的左边 " " 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag nnoremap <Leader>t :TagbarToggle<CR> " " 设置 ctags 对哪些代码标识符生成标签 \ 'PlaceNextMark' : "m,", \ 'ToggleMarkAtLine' : "m.", \ 'PurgeMarksAtLine' : "m-", \ 'PurgeMarkers' : "m<BS>", \ 'GotoNextLineAlpha' : "']", \ 'GotoPrevLineAlpha' : "'[", \ 'GotoNextSpotAlpha' : "`]", \ 'GotoPrevSpotAlpha' : "`[", \ 'GotoNextLineByPos' : "]'", \ 'GotoPrevLineByPos' : "['", \ 'GotoNextSpotByPos' : "mn", \ 'GotoPrevSpotByPos' : "mp", \ 'GotoNextMarker' : "[+", \ 'GotoPrevMarker' : "[-", \ 'GotoNextMarkerAny' : "]=", \ 'GotoPrevMarkerAny' : "[=", \ 'ListLocalMarks' : "ms", \ 'ListLocalMarkers' : "m?" " 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list nmap <Leader>f :NERDTreeToggle<CR> let NERDTreeWinPos="right" let NERDTreeAutoDeleteBuffer=1 "highlight Pmenu ctermfg=2 ctermbg=3 guifg=#005f87 guibg=#EEE8D5 "highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#AFD700 guibg=#106900 let g:ycm_complete_in_comments=1 " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示 let g:ycm_confirm_extra_conf=0 let g:ycm_collect_identifiers_from_tags_files=1 set tags+=/data/misc/software/misc./vim/stdcpp.tags " YCM 集成 OmniCppComplete 补全引擎,设置其快捷键 "inoremap <leader>; <C-x><C-o> " 补全内容不以分割子窗口形式出现,只显示补全列表 let g:ycm_min_num_of_chars_for_completion=1 let g:ycm_cache_omnifunc=0 let g:ycm_seed_identifiers_with_syntax=1 let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' ""hi LineNr cterm=bold guibg=black guifg=white ""hi CursorLine cterm=none ctermbg=lightgray ctermfg=none ""hi CursorColumn cterm=none ctermbg=lightgray ctermfg=none ""hi LineNr cterm=bold ctermbg=black ctermfg=white ""hi CursorLine cterm=none ctermbg=darkgray ctermfg=none ""hi CursorColumn cterm=none ctermbg=darkgray ctermfg=none "let g:indent_guides_enable_on_vim_startup=1 let g:indent_guides_start_level=2 "let g:indent_guides_auto_colors = 0 "hi IndentGuidesOdd guibg=red ctermbg=3 "hi IndentGuidesEven guibg=green ctermbg=4 let g:indent_guides_guide_size=1 noremap <Leader>sj :IndentGuidesToggle<CR>
3. 安装插件,顺便用vim打开一个文件,输入下面命令
:PluginInstall
三.相关错误
插件安装完后,重新用vim打开一个文件,显示下面错误:
Indexer error: Exuberant Ctags not found in PATH.
解决方法:
For Ubuntu and derivatives: sudo apt-get install exuberant-ctags
sudo yum install ctags-etags
|