git config --global diff.tool vimdiff
git config --global difftool.prompt false
Typing git difftool yields the expected behavior.
Navigation commands,
:qain vim cycles to the next file in the changeset without saving anything.
Aliasing (example)
git config --global alias.d difftool
.. will let you type git d to invoke vimdiff.
Advanced use-cases,
- By default, git calls vimdiff with the -R option. You can override it with git config –global difftool.vimdiff.cmd ‘vimdiff “$LOCAL” “$REMOTE”‘. That will open vimdiff in writeable mode which allows edits while diffing.
:wqin vim cycles to the next file in the changeset with changes saved.