vim作为强大的编辑器工具,开发人员或其他使用者经常借助插件增强其功能。本人属非计算机专业的零基础人员,在此记录下一些最基本的vim相关知识作为自己的笔记,算是自己对知识的一种学习方法吧。
Vundle是 vim bundle的简写,vim插件的管理工具。
安装:
vundle.vim的安装需要git,用如下命令进行安装:
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
如果~/.vim/bundle不存在要先创建:mkdir -p ~/.vim/bundle
配置插件:
先在用户家目录下创建vim的配置文件.vimrc,
$touch ~/.vimrc , 然后将以下内容加入.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
安装插件:
CLI中运行vim,然后运行:PluginInstall , 也可直接在CLI中运行vim +PluginInstall +qall 。
综上所述,在git clone完成后,插件的安装基本分成两步:
1 .先在.vimrc文件中配置要安装的插件;
2. 在vim中运行:PluginInstall 。