vundle是一款vim插件管理器,名字来源于vim bundle的缩写。
vundle的神奇功效:
通过.vimrc来配置插件
安装插件
更新插件
根据名字来搜索插件
清除不用的插件
通过简单的按键完成上面提到的功能
自动管理已安装脚步的运行时路径
在安装或更新时,自动生成标签
说了大堆屁话,下面来看看如何安装vundle
step1: 安装
git clone https://github.com/gmarik/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 'gmarik/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin 来源1:gitHub上的库名(需要hosted名的格式) Plugin 'tpope/vim-fugitive' " plugin 来源2: http://vim-scripts.org/vim/scripts.html上的插件名 Plugin 'L9' " 来源3: gitHub上的git库(不需要hosted名的格式) Plugin 'git://git.wincent.com/command-t.git' " 来源4:本地机器上的git库 Plugin 'file:///home/gmarik/path/to/plugin' " 来源5: 某个库的子目录 " Pass the path to set the runtimepath properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " 当有两个同名的插件时,还可以通过下面的方式来避开名字冲突 Plugin 'user/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 - list configured plugins " :PluginInstall(!) - install (update) plugins " :PluginSearch(!) foo - search (or refresh cache first) for foo " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line这个脚步只是一个例子!把你不想安装的插件删掉,同样,把你想安装的插件按照例子中的格式添加进脚本。
step3:安装
配置好.vimrc后,启动vim,在vim中运行
:PluginInstall
然后就会看到它自动帮我们安装所有配置的插件。这个命令不会重复安装已经安装过的插件,所以,当我们添加插件时,不要去注释掉之前安装过的插件。
在安装同时,vundle还会对已经安装过的插件进行检测,若有更新,它会自动帮我们更新。若vundle本身有更新,首先就会先更新自己。
若要删除插件,只需在.vimrc里注释掉相应的插件,然后打开vim,输入
PluginClean
我们只需要保存一份.vimrc配置文件,无论走到哪,更换电脑后,只需下载.vimrc,然后下载最新的vundle,就能自动搞定所有的插件。
不愧被誉为神器啊!!!
详细文档参见
:h vundle