I saw on YouTube a video made by
TJ DeVries on how to contribute to the neovim
project. There is a scene where he commit via
and whoa, a Neovim instance appeared with three split, with top left the commit
message area, top right the git-status area, and on the right the git-diff info,
which is really cool.
A little background, the default git commit only shows status info without the diff info. For commit related to changes in several files, it is difficult to remember all the diffs and summarize them in the commit message.
I searched a bit and figured out how to do it in Neovim.
Native git options
First, make sure that commit message editor is set to Vim or Neovim:
git config --global core.editor nvim
We can add
--verbose/-v option when commiting to show the diff info:
git commit -v
Better, to set it permanently (for Git version above 2.9.0):
git config --global commit.verbose true
With the above config, the diff info will be shown below the status info. For short diffs, it is acceptable, while for longer diffs, it is still not easy to check.
Using a plugin
committia.vim is a plugin that
re-arrange the commit window for easier writing of commit messages. When you
git commit, it will automatically show a three-split window like what is shown in the title image.
git commit -vby default: https://stackoverflow.com/q/5875275/6064933
- How do I make commit diff appear in commit message while I’m editing it (with Vim)?: https://stackoverflow.com/a/26457364/6064933
License CC BY-NC-ND 4.0