Retool diffing

Support mods, rename to match the built-in :diffsplit, and (perhaps
controversially) move three-way diffing to the bang variant, so that the
default behavior always focuses the other window.

Closes https://github.com/tpope/vim-fugitive/pull/715
This commit is contained in:
Tim Pope
2019-07-07 10:34:04 -04:00
parent e49b9a9303
commit cd78a08543
2 changed files with 73 additions and 50 deletions

View File

@@ -143,25 +143,28 @@ that are part of Git repositories).
:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
succeeded.
*fugitive-:Gdiff*
:Gdiff [object] Perform a |vimdiff| against the given file, or if a
*fugitive-:Gdiffsplit*
: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 is used
(which means a three-way diff during a merge conflict,
making it a git-mergetool alternative). 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 |do| and |dp| and write
to the index file to simulate "git add --patch". For
the three-way diff, there is also d2o and d3o pulling
the hunk to the middle from the left or the right
window, respectively.
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.
*fugitive-:Gsdiff*
:Gsdiff [object] Like |:Gdiff|, but always split horizontally.
*fugitive-:Gdiffsplit!*
:Gdiffsplit! [object] During a merge conflict, do a three-way diff against
both ancestors. Additional d2o and d3o maps are
provided to to obtain the hunk from the "ours" or
"theirs" ancestor, respectively. If the file is not
conflicted, behaves the same as if no bang was given,
but keeps focus in the original window.
*fugitive-:Gvdiff*
:Gvdiff [object] Like |:Gdiff|, but always split vertically.
*fugitive-:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*fugitive-:Ghdiffsplit* *fugitive-:Gsdiff*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
*fugitive-:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
@@ -276,13 +279,14 @@ i On untracked files, call |:Git| add --intent-to-add.
automatically.
*fugitive_dd*
dd Perform a |:Gdiff| on the file under the cursor.
*fugitive_ds*
ds Perform a |:Gsdiff| on the file under the cursor.
dd Perform a |:Gdiffsplit| on the file under the cursor.
*fugitive_dv*
dv Perform a |:Gvdiff| on the file under the cursor.
dv Perform a |:Gvdiffsplit| on the file under the cursor.
*fugitive_ds* *fugitive_dh*
ds Perform a |:Ghdiffsplit| on the file under the cursor.
dh
*fugitive_dp*
dp Invoke |:Git!| diff on the file under the cursor.