Skip to content

Commit 2300328

Browse files
diwogitster
authored andcommitted
mergetool: reorder vim/gvim buffers in three-way diffs
When invoking default (g)vimdiff three-way merge, the merged file is loaded as the first buffer but moved to the bottom as the fourth window. This causes a disconnect between vim commands that operate on window positions (e.g. CTRL-W_w) and those that operate on buffer index (e.g. do/dp). This change reorders the buffers to have the same index as windows while keeping the cursor default to the merged result as the bottom window. Signed-off-by: Dickson Wong <[email protected]> Tested-by: Michael J Gruber <[email protected]> Acked-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7548842 commit 2300328

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mergetools/vimdiff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ merge_cmd () {
99
gvimdiff|vimdiff)
1010
if $base_present
1111
then
12-
"$merge_tool_path" -f -d -c 'wincmd J' \
13-
"$MERGED" "$LOCAL" "$BASE" "$REMOTE"
12+
"$merge_tool_path" -f -d -c '4wincmd w | wincmd J' \
13+
"$LOCAL" "$BASE" "$REMOTE" "$MERGED"
1414
else
1515
"$merge_tool_path" -f -d -c 'wincmd l' \
1616
"$LOCAL" "$MERGED" "$REMOTE"

0 commit comments

Comments
 (0)