Use vim-plug over vundle

[vim-plug](https://github.com/junegunn/vim-plug) has a number of
advantages over Vundle:

* Installs and updates plugins very quickly in parallel
* Can lock plugins at versions/tags
* Can rollbacks updates (useful if a plugin breaks) and take/reload
  snapshots of current state
* Optionally lazily-load plugins when their relevant command is invoked
* Execute post-update hooks for plugins with compiled extensions, etc.

vim-plug uses a DSL very close to Vundle (simplest form is `Plug` vs.
`Plugin`), and here it is set to continue to use the same plugin
location that Vundle was using before.

After updating, users will need to
1. Rename `Plugin` lines in `.vimrc.bundles.local` to use `Plug`
2. Run `:PlugInstall` (the post-up hook does this)
This commit is contained in:
Geoff Harcourt 2015-02-18 21:29:50 -05:00
parent 24b34d1bec
commit 5724d124a5
3 changed files with 45 additions and 29 deletions

View file

@ -163,7 +163,7 @@ What's in it?
* Use [Exuberant Ctags](http://ctags.sourceforge.net/) for tab completion. * Use [Exuberant Ctags](http://ctags.sourceforge.net/) for tab completion.
* Use [vim-mkdir](https://github.com/pbrisbin/vim-mkdir) for automatically * Use [vim-mkdir](https://github.com/pbrisbin/vim-mkdir) for automatically
creating non-existing directories before writing the buffer. creating non-existing directories before writing the buffer.
* Use [Vundle](https://github.com/gmarik/Vundle.vim) to manage plugins. * Use [vim-plug](https://github.com/junegunn/vim-plug) to manage plugins.
[tmux](http://robots.thoughtbot.com/a-tmux-crash-course) [tmux](http://robots.thoughtbot.com/a-tmux-crash-course)
configuration: configuration:

View file

@ -2,7 +2,8 @@
touch $HOME/.psqlrc.local touch $HOME/.psqlrc.local
if [ ! -e $HOME/.vim/bundle/Vundle.vim ]; then if [ ! -e $HOME/.vim/autoload/plug.vim ]; then
git clone https://github.com/gmarik/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi fi
vim -u $HOME/.vimrc.bundles +PluginInstall +PluginClean! +qa vim -u $HOME/.vimrc.bundles +PlugInstall +PlugClean! +qa

View file

@ -2,36 +2,51 @@ if &compatible
set nocompatible set nocompatible
end end
filetype off " Shim command and function to allow migration from Vundle to vim-plug.
set rtp+=~/.vim/bundle/Vundle.vim/ function! PluginToPlug(arg, ...)
call vundle#begin() echom "You are using Vundle's `Plugin` command to declare plugins. Dotfiles now uses vim-plug for plugin mangagement. Please rename uses of `Plugin` to `Plug`. Plugin was '".a:arg."'."
let vim_plug_options = {}
" Let Vundle manage Vundle if a:0 > 0
Plugin 'gmarik/Vundle.vim' if has_key(a:1, 'name')
let name = a:1.name
let vim_plug_options.dir = "$HOME/.vim/bundle/".a:1.name
endif
if has_key(a:1, 'rtp')
let vim_plug_options.rtp = a:1.rtp
endif
endif
Plug a:arg, vim_plug_options
endfunction
com! -nargs=+ -bar Plugin call PluginToPlug(<args>)
call plug#begin('~/.vim/bundle')
" Define bundles via Github repos " Define bundles via Github repos
Plugin 'christoomey/vim-run-interactive' Plug 'christoomey/vim-run-interactive'
Plugin 'kchmck/vim-coffee-script' Plug 'kchmck/vim-coffee-script'
Plugin 'ctrlpvim/ctrlp.vim' Plug 'ctrlpvim/ctrlp.vim'
Plugin 'pbrisbin/vim-mkdir' Plug 'pbrisbin/vim-mkdir'
Plugin 'scrooloose/syntastic' Plug 'scrooloose/syntastic'
Plugin 'slim-template/vim-slim' Plug 'slim-template/vim-slim'
Plugin 'thoughtbot/vim-rspec' Plug 'thoughtbot/vim-rspec'
Plugin 'tpope/vim-bundler' Plug 'tpope/vim-bundler'
Plugin 'tpope/vim-endwise' Plug 'tpope/vim-endwise'
Plugin 'tpope/vim-eunuch' Plug 'tpope/vim-eunuch'
Plugin 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plugin 'tpope/vim-rails' Plug 'tpope/vim-rails'
Plugin 'tpope/vim-repeat' Plug 'tpope/vim-repeat'
Plugin 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plugin 'vim-ruby/vim-ruby' Plug 'vim-ruby/vim-ruby'
Plugin 'vim-scripts/ctags.vim' Plug 'vim-scripts/ctags.vim'
Plugin 'vim-scripts/matchit.zip' Plug 'vim-scripts/matchit.zip'
Plugin 'vim-scripts/tComment' Plug 'vim-scripts/tComment'
if filereadable(expand("~/.vimrc.bundles.local")) if filereadable(expand("~/.vimrc.bundles.local"))
source ~/.vimrc.bundles.local source ~/.vimrc.bundles.local
endif endif
call vundle#end() call plug#end()
filetype on