使用Vundle管理Vim插件

Vim插件繁多,质量高的也有很多。插件一装多,管理起来就麻烦了,Vim官方8.0版本之前都没有一个统一的插件管理器,8.0之后由于生态圈还没有建立起来,使用官方的插件管理工具的意义也不大。由于Github生态圈的活跃,99%的Vim插件都可以在Github上找到。Vundle利用这一点,大大简化了Vim插件的配置。使用方法如下:

将Vundle clone至用户vim目录下:

$ 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
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'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted 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'
" 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/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" 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
"
" 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

可以清晰的看到,Vundle组织了一个非常简单的插件管理方式:
比如我们要安装vim-go这一插件,找到github地址:https://github.com/fatih/vim-go
我们便只需要将
Plugin 'fatih/vim-go'
插入至如上注释表明的位置,打开vim输入:PluginInstall就大功告成了。

此处评论已关闭