用 vundle 来管理 vim 插件

  1. 首先vundle 来管理vim 是潮流,并且方便快捷

  2. 它使用类似 Ruby Bundler 的方式来管理插件,你只需要在.vimrc里面用Bundle声明插件

具体参考下面的介绍
vundle.txt

下面介绍下我的安装过程

  • 下载MacVim

  • 在~/目录下面创建 .vim 目录,然后再创建 .vim/bundle

  • cd ~/.vim/bundle 目录,然后执行 git clone https://github.com/gmarik/vundle.git 等待完成

  • 在 ~/.vimrc这个文件的头部加上下面这个配置,这个是官网的介绍

set nocompatible              " be iMproved, required
  filetype off                  " required

  " set the runtime path to include Vundle and initialize
    set rtp+=~/.vim/bundle/vundle/
  call vundle#rc()
    " alternatively, pass a path where Vundle should install plugins
    "let path = '~/some/path/here'
    "call vundle#rc(path)

    " let Vundle manage Vundle, required
    Plugin 'gmarik/vundle'

    " The following are examples of different formats supported.
    " Keep Plugin commands between here and filetype plugin indent on.
    " scripts on GitHub repos
    Plugin 'tpope/vim-fugitive'
    Plugin 'Lokaltog/vim-easymotion'
    Plugin 'tpope/vim-rails.git'
    " 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/'}
    " scripts from http://vim-scripts.org/vim/scripts.html
    Plugin 'L9'
    Plugin 'FuzzyFinder'
    " scripts not 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'
    " ...

    filetype plugin indent on     " required
    " To ignore plugin indent changes, instead use:
    "filetype plugin on
    "
    " Brief help
    " :PluginList          - list configured plugins
    " :PluginInstall(!)    - install (update) plugins
    " :PluginSearch(!) foo - search (or refresh cache first) for foo
    " :PluginClean(!)      - confirm (or auto-approve) removal of unused plugins
    "
    " see :h vundle for more details or wiki for FAQ
    " NOTE: comments after Plugin commands are not allowed.
    " Put your stuff after this line



  • 随便开个窗口,从控制台打开vim , 执行 :PluginInstall,即可安装 Plugin 指定的插件

  • 我在.vimrc 文件中,在最后一行加载 填写

           Bundle 'rking/ag.vim'

    在执行:PluginInstall 就会安装我的ag.vim