Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off gitgutter within vimrc

Tags:

vim

vim-plugin

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

like image 485
reaco Avatar asked Jun 21 '26 09:06

reaco


2 Answers

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
like image 70
Christian Brabandt Avatar answered Jun 23 '26 22:06

Christian Brabandt


As of this writing, from https://vimawesome.com/plugin/vim-gitgutter

To turn off vim-gitgutter by default

Add let g:gitgutter_enabled = 0 to your ~/.vimrc.

For example in ~/.vimrc on systems that don't have git I use

if executable('git')
   let g:gitgutter_highlight_lines = 1  " Turn on gitgutter highlighting
else
    let g:gitgutter_git_executable = '/bin/true'
    let g:gitgutter_enabled = 0
endif
like image 37
Dave C Avatar answered Jun 24 '26 00:06

Dave C