This is an enhanced version of the snippet provided under :help diff-original-file
.
Where the original :DiffOrig
only shows differences between the buffer in memory and the file on disk, :Diff
can be used in two ways:
-
against the file on disk, like the original, with:
:Diff
-
against an arbitrary Git revision of the current file, with:
:Diff HEAD
Adapted from here by checking for git dir and executable.