GitGutter plugin lets you manage your file changes within git-repository with vim by adding signs at the left side to the line numbers.

Also, you can :

  • Move between git-hunks (changes chunks)
  • Undo your git-hunks
  • See all hunks in a vim-split.

To The Point


To install gitgutter, I'd suggest using Vundle with adding this to your .vimrc config file:

Plugin 'airblade/vim-gitgutter'

Then install usually with:

vim +PluginInstall +qall

For more information about installation, check out installation guide provided by the author of the plugin.


To use this plugin all you need to do is first a add file to your git repository and then start making changes in it.

Please be adviced that Vim has an updatetime flag that I suggest you tweak from 4000ms to (as I checked) around 250ms. Changing to 250ms is a bit better and less clunky compared to what author suggests with 100ms.

To make that change, add this to your vim-config .vimrc file:

set updatetime=250

Turning gitgutter off

If you don't like how gitgutter works you may uninstall this plugin or if it's only for some of the files you can disable this plugin with vim-command:


Turning gitgutter on


GitGutter toggle on/off


Jumping to next change/chunk

Use ]c for next and [c for previous.

To customise key-mapping, use this:

nmap ]h <Plug>GitGutterNextHunk
nmap [h <Plug>GitGutterPrevHunk

Undoing your hunks

You can undo hanks with <Leader>hu or re-map key-combination with this:

nmap <Leader>hu <Plug>GitGutterUndoHunk

Preview hunk

You can preview hunk with <Leader>hp or re-map key-combination with this:

nmap <Leader>hv <Plug>GitGutterPreviewHunk


GitGutter Vim-Commands and KeyCombinations:

  • Disable: :GitGutterDisable
  • Enable: :GitGutterEnable
  • Toggle: :GitGutterToggle
  • NextHunk: ]h ( re-mapped from ]c )
  • PrevHunk: [h ( re-mapped from [c )
  • UndoHunk: <Leader>hu
  • PreviewHunk: <Leader>hv ( re-mapped from <Leader>hp )



Related links


That's it :) Comment, share or don't - up to you.

Any suggestions what I should blog about? Post me a comment in the box below or poke me at Twitter: @anselmos88.

See you in the next episode! Cheers!


comments powered by Disqus