Respect 'splitbelow' on :Gdiffsplit with argument

When calling :Gdiffsplit with no argument, we always end up with the
work tree version as half of the diff, and it is helpful to position
that consistently.  I generalized this to a consistent older versus
newer ordering when given an argument, but I don't think that has proven
very useful in practice.

This also introduces a minor behavior change where calling the bang
variant in the initial commit now loads an empty version of the buffer,
rather than falling back to the work tree.
This commit is contained in:
Tim Pope
2021-08-28 08:34:40 -04:00
parent 4603d77424
commit d523feebe9
2 changed files with 13 additions and 34 deletions

View File

@@ -184,10 +184,11 @@ that are part of Git repositories).
:Gdiffsplit [object] Perform a |vimdiff| against the given file, or if a
commit is given, the current file in that commit.
With no argument, the version in the index or work
tree is used. The newer of the two files is placed to
the right or bottom, depending on 'diffopt' and the
width of the window relative to 'textwidth'. Use
Vim's |do| and |dp| to stage and unstage changes.
tree is used, and the work tree version is always
placed to the right or bottom. A vertical split is
used if space permits, and if 'diffopt' does not
otherwise specify. Use Vim's |do| and |dp| to stage
and unstage changes.
*:Gdiffsplit!*
:Gdiffsplit! Diff against any and all direct ancestors, retaining