Type git config diff. tool winmerge . Verify it worked by typing git difftool . Get rid of the prompt typing git config --global difftool.
Ctrl+w and right and left arrow can be used to move between any split windows on vim, not only vimdiff splits. These keys do work here on cygwin; also, Ctrl+w w also moves to the next window, but without the delay you mentioned.
git config --global diff.tool vimdiff
git config --global difftool.prompt false
Typing git difftool
yields the expected behavior.
:qa
in vim cycles to the next file in the changeset without saving anything.git config --global alias.d difftool
.. will let you type git d
to invoke vimdiff.
:wq
in vim cycles to the next file in the changeset with changes saved.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
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>
If you want to permanently use vimdiff
for git diff
, you can set the ~/.gitconfig
file:
git config --global diff.tool vimdiff
and then you can use git difftool
to diff.
If you only want to temporarily use vimdiff
, you can run the command every time:
git difftool --tool=vimdiff
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