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 <dicksonwong@gmail.com> Tested-by: Michael J Gruber <git@drmicha.warpmail.net> Acked-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dickson Wong committed Jan 28, 2016 at 18:18 UTC 2300328cb209762a14e32525cfaa91778681f059
1 file changed +2 -2
mergetools/vimdiff
+2 -2
@@ -9,8 +9,8 @@ merge_cmd () {
9 gvimdiff|vimdiff)
10 if $base_present
11 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"
14 else
15 "$merge_tool_path" -f -d -c 'wincmd l' \
16 "$LOCAL" "$MERGED" "$REMOTE"