Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to Disable a Plugin #469

Closed
3 of 11 tasks
LandonSchropp opened this issue Apr 12, 2016 · 4 comments
Closed
3 of 11 tasks

Option to Disable a Plugin #469

LandonSchropp opened this issue Apr 12, 2016 · 4 comments
Labels

Comments

@LandonSchropp
Copy link

I'm using Thoughtbot's dotfiles, which installs Syntastic by default. Since I'm using Neovim, I'd like for a way to disable the prevent Syntastic from being installed and install Neomake instead.

For sample, I'd like to do something like this:

" In Thoughtbot's .vimrc
Plug 'scrooloose/syntastic'

...

" In my .vimrc
Unplug 'scrooloose/syntastic'
Plug 'benekastah/neomake'

Is something like that possible? Thanks in advance!

P.S. Thanks for creating such a great plugin manager!


NVIM 0.1.2
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99
 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/b
uild/config -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/src -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim201603
07-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include/luajit-2.0 -I/tmp/neovim2016030
7-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160307-12635-1qup
gzn/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/deps-build/usr/include -I/usr/local/opt/gettext/include -I/usr/incl
ude -I/usr/include -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/build/src/nvim/auto -I/tmp/neovim20160307-12635-1qupgzn/neovim-0.1.2/build/include
Compiled by landon@landon.local

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.1.2/share/nvim"
  • Type:
    • Bug
    • Enhancement
    • Feature Request
    • Question
  • OS:
    • All/Other
    • Linux
    • OS X
    • Windows
  • Vim:
    • Terminal Vim
    • GVim
    • Neovim
@junegunn
Copy link
Owner

  1. Remove if from g:plugs: call remove(g:plugs, 'syntastic')
  2. Override it so that it's not loaded: Plug 'scrooloose/syntastic', { 'on': [] }
    • It will be still installed though
  3. Fork the repo, which I honestly think is the best approach :)

(1 and 2 should be done before call plug#end())

@LandonSchropp
Copy link
Author

Thanks!

@smancill
Copy link

Just for the record, this solution worked for me.

The plugin must be removed from both g:plugs and g:plugs_order,
so I created the UnPlug command which call a custom function.

vimrc:

function! s:deregister(repo)
  let repo = substitute(a:repo, '[\/]\+$', '', '')
  let name = fnamemodify(repo, ':t:s?\.git$??')
  call remove(g:plugs, name)
  call remove(g:plugs_order, index(g:plugs_order, name))
endfunction

command! -nargs=1 -bar UnPlug call s:deregister(<args>)


call plug#begin('~/.vim/bundle')

" Load bundles
source ~/.vim/bundle.vim

" Load bundles of the fork
if filereadable(expand("~/.vim/bundle.fork"))
  source ~/.vim/bundle.fork
endif

" Load bundles of the local machine
if filereadable(expand("~/.vim/bundle.local"))
  source ~/.vim/bundle.local
endif

call plug#end()

delcom UnPlug

bundle.vim:

" ...
Plug 'kien/ctrlp.vim'
" ...

bundle.local:

" Disable
UnPlug 'kien/ctrlp.vim'
" Replace
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'

@junegunn
Copy link
Owner

The plugin must be removed from both g:plugs and g:plugs_order

Hmm, you're right. I'll make the code ignore any entry in g:plugs_order that is not found in g:plugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants