VIM插件管理器之vundle

来源:互联网 发布:外国人看中国妹子知乎 编辑:程序博客网 时间:2024/06/06 01:34
VIM 插件管理器之vundle
VIM虽然功能很强大,但要使其好用,支持更多的功能,不可缺少插件(plugin),不过VIM本身对插件(plugin)的安装很不简单(1、需要将其放到.vim目录下,2、运行helptags~/.vim/doc更新帮助文件,3、|:h帮助文件|),更加重要的是其卸载太麻烦(1、需要到各个不同的目录下删除对应文件,2、运行helptags~/.vim/doc更新帮助文件)。VIM自己的网站虽然有script这个地方让人上传插件,不过基本上都不太好用,所以有些开发者不会吧插件放到这,取而代之,这些年主流的方式是github放置VIM插件,然后配上pathogen来安装和管理,不但让插件安装时不互相干扰,用git管理的插件也可以直接更新,要卸载也很容易,只需直接删除相应目录就可以。
   gmarik受到pathogen和 ruby的 bunler的启发,开发了vundle这个VIM插件,出了可以像pathogen那样把插件分到不同的目录管理,更厉害的是可以很简单的新增要安装的插件,然后透过指令简单的安装和更新。

安装vundle(github的vundle主界面有安装介绍)
  1. Setup Vundle:

     $ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
  2. Configure bundles:

    Sample .vimrc,添加如下语句到.vimrc文件中。

       set nocompatible               " be iMproved filetype off                   " required! set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage Vundle " required!  Bundle 'gmarik/vundle' " My Bundles here: " original repos on github Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/vim-easymotion' Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} Bundle 'tpope/vim-rails.git' " vim-scripts repos Bundle 'L9' Bundle 'FuzzyFinder' " non github repos Bundle 'git://git.wincent.com/command-t.git' " ... filetype plugin indent on     " required! " Brief help " :BundleList          - list configured bundles " :BundleInstall(!)    - install(update) bundles " :BundleSearch(!) foo - search(or refresh cache first) for foo " :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles " see :h vundle for more details or wiki for FAQ " NOTE: comments after Bundle command are not allowed..
  3. Install configured bundles:

    Launch vim, run :BundleInstall (orvim +BundleInstall +qall for CLI lovers)

    Windows users see Vundlefor Windows

    Installing requires Git andtriggersGit clonefor each configured repo to~/.vim/bundle/.

     (这里需要特别注意,要安装vundle需要安装了git并且git clone要能正常使用)
注意bundle支持安装的插件类型:

Bundle 支持的格式有三种:

  1. 第一种是一个普通的字符串,就是 vim 插件页面里左上角的插件名字,如果插件名有空格,使用 - 替换。这种类型会去找 VimScript 里面的插件。
  2. 第二种是github帐号/项目名。其实也就是github插件页面路径的后面那段。
  3. 第三种就是git repository

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

Bundle不能寻找到的插件

对于bundle不能寻找到的插件,可以按VIM原始的方式安装,bundle的安装方式和VIM原始的安装方式并不冲突。

附录:
VIM script插件网址:http://www.vim.org/scripts/index.php
github 插件网址:https://github.com/repositories


0 0
原创粉丝点击