My biggest bottleneck in vim is the moment when I need to write a commit. Often, i do not remember the diff. First I write "git diff". Then I write "git commit" but, ... "Hey! I do not remember ...". Thus, I need to stop to write commit message, then I come back and run diff message. Sometimes I work with two windows: on the left I run "git diff". On the right I run "git commit". This allow me to write a commit message complete, while I can watch the diff of each file, ... and so on.
Can someone help me to improve this moment in vim workflow?
Use git commit -v
to see the diff in vim while committing.
-v, --verbose
Show unified diff between the HEAD commit and what would be
committed at the bottom of the commit message template. Note
that this diff output doesn't have its lines prefixed with #.
The ftplugin/gitcommit.vim
that ships with Vim has a :DiffGitCached
command, which opens the diff in a split scratch buffer. I've assigned a quick mapping to it (in ~/.vim/after/ftplugin/gitcommit.vim
):
nnoremap <LocalLeader><LocalLeader> :DiffGitCached<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With