Windows下 vundle的安装和使用

 准备工作

1. 安装git

官网下载,安装即可。

2. 添加git的环境变量

并将Git 的安装路径加入环境变量Path,如

D:Program FilesGitcmd  

然后运行cmd,输入

git --version

如果能显示Git版本信息,说明安装成功。

3. 配置Curl脚本

在Windows下还需要建立一个Curl脚本用于Vundle的远程链接。在Git的路径下新建一个空文本文件,改名为curl.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%in;%git_install_root%mingwin;%PATH%  
  
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%  
@if not exist "%HOME%" @set HOME=%USERPROFILE%  
  
@curl.exe %*

保存后运行cmd,输入

curl --version 

 如果可以看到版本信息说明配置成功。

4. 安装Vundle

Git安装完成后,从官网Clone Vundle到Vim的安装路径下,如

git clone https://github.com/gmarik/vundle.git D:/ProgramFiles/vim/vimfiles/bundle/vundle

 此时Vim的目录结构应该如下所示

D:Vim

+---vim80

+---vimfiles

      +---bundle

             +---vundle

                    +---autoload

5. 配置Vundle

按照Vundle官方给出的配置,所有通过Vundle安装的插件会被安装到Windows的用户目录下,这里做了修改,直接安装到Vim目录下方便管理。

编辑_vimrc文件,加入

filetype off  
" 此处规定Vundle的路径  
set rtp+=$VIM/vimfiles/bundle/vundle/  
call vundle#rc('$VIM/vimfiles/bundle/')  
Bundle 'gmarik/vundle'  
filetype plugin indent on  
  
" original repos on github<br>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!   

 6. 安装插件

进入vim,运行:

:BundleInstall  

7. 卸载插件

如果要卸载插件就只需要删除.vimrc中的Bundle,然后在Vim中执行
:BundleClean  

 Vundle常用命令

:BundleList              -列举列表(也就是.vimrc)中配置的所有插件  
:BundleInstall          -安装列表中的全部插件  
:BundleInstall!         -更新列表中的全部插件  
:BundleSearch foo   -查找foo插件  
:BundleSearch! foo  -刷新foo插件缓存  
:BundleClean           -清除列表中没有的插件  
:BundleClean!          -清除列表中没有的插件  
附:参考文献

vim-scripts维护的GitHub repo

原文地址:https://www.cnblogs.com/qiyuexin/p/7073006.html