您的位置:首页 > 其它

使用Vundle 来管理 Vim 插件

2011-07-31 17:23 716 查看
VIM 是编辑器之神,没有自带插件管理功能比较遗憾,不过vim的扩张性非常好,今天发现有一个叫Vundle的插件可以通过git来查找和更新vim插件。以前我是使用pathogen來安装和管理的,

不过pathogen没有自动查找插件的功能,需要自己将插件一个个文件分开来更新管理。现在只要进入 vim 执行:BundleInstall就可以下载插件了,如果要更新就输入:BundleInstall!

下面我来介绍一下Vundle在window下的安装方法:

1.下载 msysgit

2.安装 msysgit,安装的时候可以入下图一样选择 git 运行在 win 的命令行,或者自己手动将 "git所在路径\git\bin" 添加到系统的PATH里



3.将下面的代码保存为 curl.cmd, 然后复制到 "git所在路径\git\cmd\" 目录里。

@rem Do not use "echo off" to not affect any child calls.
@setlocal

@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@curl.exe %*


4.下载 Vundle ,然后复制到 “Vim\vimfiles” 目录里。

5.在vim 配置文件里添加下面的代码,就大功告成了

set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" original repos on github
Bundle 'mattn/zencoding-vim'
Bundle 'drmingdrmer/xptemplate

" vim-scripts repos
Bundle 'L9
Bundle 'FuzzyFinder'
Bundle 'bufexplorer.zip'
Bundle 'taglist.vim'
Bundle 'Mark'
Bundle 'The-NERD-tree'
Bundle 'matrix.vim'
Bundle 'closetag.vim'
Bundle 'The-NERD-Commenter'
Bundle 'matchit.zip'
Bundle 'AutoComplPop'
Bundle 'jsbeautify'
Bundle 'YankRing.vim'

filetype plugin indent on     " required!


Bundle 支持的格式有三种:

第一种是一个普通的字符串,就是 vim 插件页面里左上角的插件名字,如果插件名有空格,使用 - 替换。

第二种是github帐号/项目名。

第三种就是git repository

现在大家就可以使用 :BundleInstall ,:BundleInstall! 来下载插件和更新插件了,是不是很方便。

声明: 转载请注明转自--强记JSON对象和字符串之间的相互转换
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: