在Linux中使用Vundle管理Vim插件的方法

2019-01-16 21:54:46王冬梅

" 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

被标记为 “required” 的行是 Vundle 的所需配置。其余行仅是一些例子。如果你不想安装那些特定的插件,可以移除它们。完成后,键入 :wq 保存退出。

最后,打开 Vim:

vim

然后键入下列命令安装插件:

:PluginInstall

将会弹出一个新的分窗口,我们加在 .vimrc 文件中的所有插件都会自动安装。

安装完毕之后,键入下列命令,可以删除高速缓存区缓存并关闭窗口:

:bdelete

你也可以在终端上使用下面命令安装插件,而不用打开 Vim:

vim +PluginInstall +qall

使用 fish shell 的朋友,添加下面这行到你的 .vimrc 文件中。

set shell=/bin/bash

使用 Vundle 管理 Vim 插件

添加新的插件

首先,使用下面的命令搜索可以使用的插件:

:PluginSearch

要从 vimscripts 网站刷新本地的列表,请在命令之后添加 !。

:PluginSearch!

会弹出一个列出可用插件列表的新分窗口: