Search code examples
vimvim-plugin

Turn off gitgutter within vimrc


I've installed gitgutter and want to have it off by default. The documentation says use

:GitGutterDisable

to do this. And if I'm in a vim session this works. However I want to add this to my vimrc to make it permanent.

I've tried adapting other plugin commands within vimrc such as

let g:GitGutterDisable

and various other combinations but can't get the damn thing to turn off. I also looked in ~/.vim/bundle/vim-gitgutter/plugin/gitgutter.vim and fiddled with a few settings there.

I got close with setting the below to zero

call s:set('g:gitgutter_enabled',                     1)

but this just permanently turned it off, ie :GitGutterSignsToggle on the vim command line no longer worked


Solution

  • Your vimrc loads before any plugins are available. That means, that commands, that are defined by plugins are not yet defined. Therefore, I would advise to use the VimEnter autocommand like this:

    :au VimEnter * :GitGutterDisable