Skip to content

Instantly share code, notes, and snippets.

@mikew
Created March 8, 2016 21:24
Show Gist options
  • Save mikew/5b8c00e6b896951e1f4e to your computer and use it in GitHub Desktop.
Save mikew/5b8c00e6b896951e1f4e to your computer and use it in GitHub Desktop.
A way to disable a plugin in vim-plug

plug_disable.vim

If your vim distribution uses vim-plug and includes plugins you don't want, or if you want to simply maintain a single set of plugins but disable some on certain machines, this may be for you.

Source

let g:plugs_disabled = []
function! plug_disable#commit()
  for name in g:plugs_disabled
    if has_key(g:plugs, name)
      call remove(g:plugs, name)
    endif

    let idx = index(g:plugs_order, name)
    if idx > -1
      call remove(g:plugs_order, idx)
    endif
  endfor
endfunction

Usage

let g:plugs_disabled = ['nerdtree']

call plug#begin()
  Plug 'scrooloose/nerdtree'
  Plug 'mileszs/ack.vim'
  call plug_disable#commit()
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment