I setup git diff
to wrap into vimdiff, using \"Git Diff with Vimdiff\" as a guide, and it\'s working as expected unless there are many files with changes.
For people who want to use another diff tool not listed in git, say with nvim
. here is what I ended up using:
git config --global alias.d difftool -x <tool name>
In my case, I set <tool name>
to nvim -d
and invoke the diff command with
git d <file>
git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool
Typing git d
yields the expected behavior, typing :wq
in vim cycles to the next file in the changeset.
You can try git difftool
, it is designed to do this stuff.
First, you need to config diff tool to vimdiff
git config diff.tool vimdiff
Then, when you want to diff, just use git difftool
instead of git diff
. It will work as you expect.
Git accepts kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
and opendiff as valid diff tools. You can also set up a custom tool.
git config --global diff.tool vimdiff
git config --global diff.tool kdiff3
git config --global diff.tool meld
git config --global diff.tool xxdiff
git config --global diff.tool emerge
git config --global diff.tool gvimdiff
git config --global diff.tool ecmerge