Wednesday, November 6, 2013

Vim Gitgutter

Vim Gitgutter Vim Gitgutter shows a diff in the sign (left-hand) column of your editing window. This is a really cool way to see what portions of a file have changed without resorting to git diff.

Droggl asked how to disable vim-gutter when viewing log files because of slowness. I've come up with the following solution which seems like it should work.

Assuming your log files end in *.log, add the following to your ~/.vimrc.
autocmd BufNewFile,BufReadPost *.log setlocal filetype=log
filetype plugin on
Then make an entry like so in ~/.vim/ftplugin/log.vim
Hope that helps!


Anonymous said...

The diff hunk navigation feature is also really helpful to me, to quickly navigate between the parts of a file I'm modifying for a particular commit. I believe the bindings are on by default and are ]h to go to next hunk and [h to go to previous hunk.

Anonymous said...

Gitgutter is awesome, thanks :)
I found though that it can terribly slow down vim, e.g. when viewing logfiles (that are of course not checked in in git).
Did you find a way to automatically enable/disable it e.g. on file ending?