Last Updated: February 25, 2016
·
949
· xan

View git commit changes in vim

You use git and you write your commit messages in vim.

You like to see the changes you staged while you write your comment.

If that's the case you can add this line to your vimrc

autocmd FileType gitcommit DiffGitCached | wincmd J

That tells vim to run the command DiffGitCached and wincmd J when opening the filetype gitcommit. As you can imagine the DiffGitCached command opens a buffer to show the git diff --cached output. wincmd J is there just to moves the panel on the right-hand side.

Original source Stackoverflow