本文共 4216 字,大约阅读时间需要 14 分钟。
Linux x64系统
Vundle是Vim bundle的缩写,是Vim插件管理器。
Vundle允许你…
跟踪并配置您的插件.vimrc
安装配置的插件(又名脚本/包)
更新配置的插件
按名称搜索所有可用的Vim脚本
清理未使用的插件
使用交互模式在单个按键中运行上述操作
Vundle自动…
使用git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
命令下载源码,默认安装在/.vim/bundle/vundle下;如果/.vim/bundle/vundle不存在,使用
madir -p /.vim/bundle/vundle
来建立目录;
vim ~/. vimrc
打开vimrc进行配置, 在vimrc头部添加如下配置,根据需要修改插件(文末有中文版),保存。
set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.html" 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 lineset number
将想要安装的插件,按照上文代码中的示例填写,如:GitHub上的插件格式为 Plugin ‘用户名/插件仓库名’
填写在vundle#begin和vundle#end之间就可以。
在vundle#begin和vundle#end之间填写:
Plugin 'ycm-core/YouCompleteMe'
当然也可以参考YouCompleteMe的GitHub上的,直接使用 install.py
来安装YouCompleteMe。
参考:https://github.com/ycm-core/YouCompleteMe
保存之后,有两种方法安装插件。
vim
,再在vim中运行 :PluginInstall
vim +PluginInstall +qall
安装完成之后,插件就可以使用了。
注:YCM不小,轻耐心等待。在墙内的速度可能会慢一点。
更新插件BundleUpdate
BundleList
查找插件BundleSearch
" 常用的命令
:PluginList
- 列出所有已配置的插件 :PluginInstall
- 安装插件,追加 !
用以更新或使用 :PluginUpdate :PluginSearch foo
- 搜索 foo ; 追加 !
清除本地缓存 :PluginClean
- 清除未使用插件,需要确认; 追加 !
自动批准移除未使用插件 see
PS: reference 4 是一个很炫酷的配置方案。
Reference:
set nocompatible " 去除VI一致性,必须要添加filetype off " 必须要添加" 设置包括vundle和初始化相关的runtime pathset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" 另一种选择, 指定一个vundle安装插件的路径"call vundle#begin('~/some/path/here')" 让vundle管理插件版本,必须Plugin 'VundleVim/Vundle.vim'" 以下范例用来支持不同格式的插件安装." 请将安装插件的命令放在vundle#begin和vundle#end之间." Github上的插件" 格式为 Plugin '用户名/插件仓库名'Plugin 'tpope/vim-fugitive'" 来自 http://vim-scripts.org/vim/scripts.html 的插件" Plugin '插件名称' 实际上是 Plugin 'vim-scripts/插件仓库名' 只是此处的用户名可以省略Plugin 'L9'" 由Git支持但不再github上的插件仓库 Plugin 'git clone 后面的地址'Plugin 'git://git.wincent.com/command-t.git'" 本地的Git仓库(例如自己的插件) Plugin 'file:///+本地插件仓库绝对路径'Plugin 'file:///home/gmarik/path/to/plugin'" 插件在仓库的子目录中." 正确指定路径用以设置runtimepath. 以下范例插件在sparkup/vim目录下Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}" 安装L9,如果已经安装过这个插件,可利用以下格式避免命名冲突Plugin 'ascenator/L9', {'name': 'newL9'}" 你的所有插件需要在下面这行之前call vundle#end() " 必须filetype plugin indent on " 必须 加载vim自带和插件相应的语法和文件类型相关脚本" 忽视插件改变缩进,可以使用以下替代:"filetype plugin on"" 常用的命令" :PluginList - 列出所有已配置的插件" :PluginInstall - 安装插件,追加 `!` 用以更新或使用 :PluginUpdate" :PluginSearch foo - 搜索 foo ; 追加 `!` 清除本地缓存" :PluginClean - 清除未使用插件,需要确认; 追加 `!` 自动批准移除未使用插件"" 查阅 :h vundle 获取更多细节和wiki以及FAQ" 将你自己对非插件片段放在这行之后
转载地址:http://seezk.baihongyu.com/