Vim 插件安装(Vundle)

Abstract:

Vim非常强大,其中一个重要原因是丰富的插件。为了高效管理插件,Vundle(Vim bundle)是不错的选择,它也是一个vim的插件,但它可以管理其他插件,所以装好它其它插件都so easy.

Content:

以下安装基于linux,参考自Vundle在github上的项目说明,原文写得很清楚,这里只是简单翻译。

建立Vundle:

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Vundle配置(.vimrc):

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Bundle 'Valloric/YoucompleteMe'
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

可以看到想安装插件只要在call vundel#begin()call vundle#end()间加入相应的插件即可自动管理(格式如Plugin 'VundleVim/Vundle.vim',该插件是必须的)。实践发现在call vundle#end()之后用Bundle $PluginName(格式如Bundle 'Valloric/YoucompleteMe')也可以和上述Plugin $PluginName方式一样管理插件。

安装插件:

记得先source $vimrcfile($vimrcfile为上面的vimrc),让其生效。然后
打开vim输入

:PluginInstall

或在终端输入

$ vim +PluginInstall +qall

update插件:

打开vim输入

:PluginUpdate

或在终端输入

$ vim +PluginUpdate +qall

History:

  • 2016-09-11: 将内容记录下来
  • 2016-09-13: 修改排版
  • 2018-01-06: add update plugin