Allow user to ignore some default vim plugins

The `UnPlug` command allows a user to remove a plugin from vim-plug's
list of plugins to install/activate. This command can be used to
selectively ignore shared plugins from `vimrc.bundles` without needing
to overwrite the entire file with a personal replacement.

This change is dependent on vim-plug continuing to use the `g:plugs`
global variable.
This commit is contained in:
Geoff Harcourt 2016-10-31 21:21:40 -04:00
parent b9b9e7db8c
commit 3bbab420bc
2 changed files with 26 additions and 0 deletions

View file

@ -94,6 +94,24 @@ Your `~/dotfiles-local/vimrc.local` might look like this:
highlight NonText guibg=#060606
highlight Folded guibg=#0A0A0A guifg=#9090D0
If you don't wish to install a vim plugin from the default set of vim plugins in
`.vimrc.bundles`, you can ignore the plugin by calling it out with `UnPlug` in
your `~/.vimrc.bundles.local`.
" Don't install vim-scripts/tComment
UnPlug 'tComment'
`UnPlug` can be used to install your own fork of a plugin or to install a shared
plugin with different custom options.
" Only load vim-coffee-script if a Coffeescript buffer is created
UnPlug 'vim-coffee-script'
Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
" Use a personal fork of vim-run-interactive
UnPlug 'vim-run-interactive'
Plug '$HOME/plugins/vim-run-interactive'
To extend your `git` hooks, create executable scripts in
`~/dotfiles-local/git_template.local/hooks/*` files.

View file

@ -2,6 +2,14 @@ if &compatible
set nocompatible
end
" Remove declared plugins
function! s:UnPlug(plug_name)
if has_key(g:plugs, a:plug_name)
call remove(g:plugs, a:plug_name)
endif
endfunction
command! -nargs=1 UnPlug call s:UnPlug(<args>)
" Shim command and function to allow migration from Vundle to vim-plug.
function! VundleToPlug(vundle_command, arg, ...)
echom "You are using Vundle's `".a:vundle_command."` command to declare plugins. Dotfiles now uses vim-plug for plugin management. Please rename uses of `".a:vundle_command."` to `Plug`. Plugin was '".a:arg."'."