如何在 Linux 上使用 Vundle 管理 Vim 插件 | Linux 中国
2018-03-08 00:00
1241 查看
由于所有的插件文件都被存储在同一个目录下,所以当你安装更多插件时,不同的插件文件之间相互混淆。因而,跟踪和管理它们将是一个恐怖的任务。-- Sk
有用的原文链接请访问文末的“原文链接”获得可点击的文内链接、全尺寸原图和相关文章。
致谢编译自 | https://www.ostechnix.com/manage-vim-plugins-using-vundle-linux/
作者 | Sk
译者 | ChenYi (cyleft) ? ? ? 共计翻译:21 篇 贡献时间:59 天毋庸置疑,Vim 是一款强大的文本文件处理的通用工具,能够管理系统配置文件和编写代码。通过插件,Vim 可以被拓展出不同层次的功能。通常,所有的插件和附属的配置文件都会存放在
~/.vim目录中。由于所有的插件文件都被存储在同一个目录下,所以当你安装更多插件时,不同的插件文件之间相互混淆。因而,跟踪和管理它们将是一个恐怖的任务。然而,这正是 Vundle 所能处理的。Vundle,分别是 Vim 和 Bundle 的缩写,它是一款能够管理 Vim 插件的极其实用的工具。Vundle 为每一个你安装的插件创建一个独立的目录树,并在相应的插件目录中存储附加的配置文件。因此,相互之间没有混淆的文件。简言之,Vundle 允许你安装新的插件、配置已有的插件、更新插件配置、搜索安装的插件和清理不使用的插件。所有的操作都可以在一键交互模式下完成。在这个简易的教程中,让我告诉你如何安装 Vundle,如何在 GNU/Linux 中使用它来管理 Vim 插件。Vundle 安装如果你需要 Vundle,那我就当作你的系统中,已将安装好了 Vim。如果没有,请安装 Vim 和 git(以下载 Vundle)。在大部分 GNU/Linux 发行版中的官方仓库中都可以获取到这两个包。比如,在 Debian 系列系统中,你可以使用下面的命令安装这两个包。
sudo apt-get install vim git
下载 Vundle复制 Vundle 的 GitHub 仓库地址:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
配置 Vundle创建
~/.vimrc文件,以通知 Vim 使用新的插件管理器。安装、更新、配置和移除插件需要这个文件。
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[/code]" Plugin 'L9'" Git plugin not hosted on GitHubPlugin '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 linecall vundle#end() " requiredfiletype 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[1] 的朋友,添加下面这行到你的
.vimrc文件中。
set shell=/bin/bash
使用 Vundle 管理 Vim 插件添加新的插件首先,使用下面的命令搜索可以使用的插件:
:PluginSearch
要从 vimscripts 网站刷新本地的列表,请在命令之后添加
!。
:PluginSearch!
会弹出一个列出可用插件列表的新分窗口:
你还可以通过直接指定插件名的方式,缩小搜索范围。
:PluginSearch vim
这样将会列出包含关键词 “vim” 的插件。当然你也可以指定确切的插件名,比如:
:PluginSearch vim-dasm
移动焦点到正确的一行上,按下
i键来安装插件。现在,被选择的插件将会被安装。
类似的,在你的系统中安装所有想要的插件。一旦安装成功,使用下列命令删除 Vundle 缓存:
:bdelete
现在,插件已经安装完成。为了让插件正确的自动加载,我们需要在
.vimrc文件中添加安装好的插件名。这样做:
:e ~/.vimrc
添加这一行:
[...]
Plugin 'vim-dasm'
[...]
用自己的插件名替换 vim-dasm。然后,敲击
ESC,键入
:wq保存退出。请注意,所有插件都必须在
.vimrc文件中追加如下内容。
[...]
filetype plugin indent on
列出已安装的插件键入下面命令列出所有已安装的插件:
:PluginList
更新插件键入下列命令更新插件:
:PluginUpdate
键入下列命令重新安装所有插件:
:PluginInstall!
卸载插件首先,列出所有已安装的插件:
:PluginList
之后将焦点置于正确的一行上,按下
SHITF+d组合键。
然后编辑你的
.vimrc文件:
:e ~/.vimrc
删除插件入口。最后,键入
:wq保存退出。或者,你可以通过移除插件所在
.vimrc文件行,并且执行下列命令,卸载插件:
:PluginClean
这个命令将会移除所有不在你的
.vimrc文件中但是存在于 bundle 目录中的插件。你应该已经掌握了 Vundle 管理插件的基本方法了。在 Vim 中使用下列命令,查询帮助文档,获取更多细节。
:h vundle
现在我已经把所有内容都告诉你了。很快,我就会出下一篇教程。保持关注!干杯!资源Vundle GitHub 仓库[2]via: https://www.ostechnix.com/manage-vim-plugins-using-vundle-linux/作者:SK[4] 译者:CYLeft 校对:wxy本文由 LCTT 原创编译,Linux中国 荣誉推出
相关文章推荐
- 如何在 Linux 上使用 Vundle 管理 Vim 插件
- 如何在 Linux 上使用 Vundle 管理 Vim 插件
- 在Linux中使用Vundle管理Vim插件的方法
- 使用vundle进行Vim插件管理
- 使用Github和Vundle管理Vim插件和配置文件
- [Ubuntu] 使用Vundle管理vim的插件
- VIM使用(一) VIM插件管理利器-vundle
- 使用Vundle 来管理 Vim 插件
- 使用Vundle来管理vim的插件
- 如何使用 Seahorse 管理 PGP 和 SSH 密钥 | Linux 中国
- Vim技能修炼教程(1) - 使用vundle管理插件
- 使用vundle管理vim插件(转载)
- 使用Vundle管理Vim插件
- Vim插件管理工具Vundle的安装与使用
- Vim技能修炼教程(1)-使用vundle管理插件
- 使用vundle管理vim插件
- 使用Vundle管理Vim插件
- linux下vim插件管理 vundle
- 如何优雅地使用 VIM 文件管理插件 NERDTree
- Windows下VIM使用Vundle管理插件