使用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

相關文章
相關標籤/搜索