An interesting feature in mercurial is the ability to view the changes that will be committed in a vim split (see DiffsInCommitMessageInVIM).
Any hint on how to do so with git ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you’ve got syntax enabled, Vim detects git commit messages as a filetype. This should be obvious from highlighting. The much less obvious part is that it also has a filetype plugin for git commits (and other git things). Make sure you have those enabled (
filetype plugin on), and then there will be a helpful command defined:DiffGitCached. Just run that, and it’ll toss a diff into a preview window.A comment next to the definition of that command in the plugin:
The filetype plugins are stored in /vimXX/ftplugin/git*.vim, e.g.
/usr/share/vim/vim70/ftplugin/gitcommit.vim, if you’re curious to have a look!