VIM插件管理器之vundle

Vundle作为VIM插件管理工具,简化了插件的安装与更新过程。通过配置.vimrc文件,用户可以轻松管理各种来源的插件,包括GitHub上的项目和VimScript插件库。此外,Vundle还支持多种命令帮助用户更好地管理和维护已安装的插件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 andtriggers Git 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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值