使用Vundle来管理vim的插件

使用Vundle来管理vim的插件

字数554 阅读5840 评论2 喜欢1html

用 vundle 来管理 vim 插件

  1. 首先vundle 来管理vim 是潮流,而且方便快捷
  2. 它使用相似 Ruby Bundler 的方式来管理插件,你只须要在.vimrc里面用Bundle声明插件

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

下面介绍下个人安装过程github

  • 下载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 文件中,在最后一行加载 填写vim

    Bundle 'rking/ag.vim'

    在执行:PluginInstall 就会安装个人ag.vimruby

    最后在个人MacVim就可使用 :Ag bababab 就可使用了。
    顺便说下,比 ack 更快更好用的东东:the silver searcher, 速度能提高5倍。app

 

 

 

 

 

 

 

 

 

以前一直用pathogen来管理vim插件,各方面还好,可是有几个缺点让人很难受:

1. 很难和别人分享你的vim配置和插件库。由于你要详细的告诉别人你都安装了哪些插件,或者你干脆把插件文件都copy给他。

2. 插件升级比较繁琐,你要一个个的cd到插件目录,而后执行 git pull 。字体

后来发现了vundle,感受这才是世界潮 流,它使用相似 Ruby Bundler 的方式来管理插件,你只须要在.vimrc里面用Bundle声明插件,而后在vim里面用:BundleInstall 安装全部插件,用 :BundleInstall! 来更新插件。其余功能包括:查询插件和清除不须要的脚本目录,详情能够参考vundle.txt

在这里分享一下个人.vimrc.gvimrc ,如今终于能够分享后一键安装了。ui

这里我说一下MacOS下的安装步骤:

1. 到这里下载 MacVim

2. 在~/目录下面建立 .vim 目录,而后再建立 .vim/bundle

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

4. 而后下载我上面分享的哪两个文件 .vimrc, .gvimrc 放到你的home(~/)目录下面

5. 随便开个窗口,从控制台打开vim 或者 gvim ,而后执行-> :BundleInstall ,vundle会自动下载声明的插件并安装到 ./vim/bundle 目录里面

到此,安装结束,能够畅游vim了。this

若是你的 Powerline 没有华丽丽的面包屑效果,能够执行以下操做,给字体打个补丁:

1. fontforge -script ~/.vim/bundle/vim-powerline/fontpatcher/fontpatcher ~/Library/Fonts/Your-font-name.ttf

2. rm ~/tmp/Powerline_default_default_compatible.cachegoogle

Source From

相关文章
相关标签/搜索