7

This may be a weird question, because I already have this setup in my dotfiles somewhere, I just don't know how to tell a friend to set it up in their dotfiles.

I want to know how to get a nice git diff displayed in your gitcommit file, whenever you compose a git commit message with vim. Here are my dotfiles if that helps. I couldn't find the answer online and it was hard to search without knowing what to search for.

enter image description here

11

This behavior seems to come from calling git commit -v or git commit --verbose. Not sure where you're doing that in your dotfiles, but I'd recommend telling him to set an alias in his git config that does that.

3

Additionally, Do try out committia.vim, a plugin for writing a commit message. When git commiting, it splits the window and shows the diff and status window very nicely.

3

Alternatively you can use Tim Pope's fugitive.vim. It provides :Gcommit which is a wrapper around git commit (So you can do :Gcommit --verbose).

Probably the more preferred way would be to use :Gstatus and execute cvc. Then just create your commit message and then save and quit (I use :x).

For more help with fugitive.vim I recommend Vimcasts episodes mentioned in this article: The Fugitive Series - a retrospective.

For more help see:

:h :Gcommit
:h :Gstatus

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.