Skip to content

Commit 30bb808

Browse files
whiteingegitster
authored andcommitted
mergetools/vimdiff: add vimdiff1 merge tool variant
This adds yet another vimdiff/gvimdiff variant and presents conflicts as a two-way diff between 'LOCAL' and 'REMOTE'. 'MERGED' is not opened which deviates from the norm so usage text is echoed as a Vim message on startup that instructs the user with how to proceed and how to abort. Vimdiff is well-suited to two-way diffs so this is an option for a more simple, more streamlined conflict resolution. For example: it is difficult to communicate differences across more than two files using only syntax highlighting; default vimdiff commands to get and put changes between buffers do not need the user to manually specify a source or destination buffer when only using two buffers. Like other merge tools that directly compare 'LOCAL' with 'REMOTE', this tool will benefit when paired with the new `mergetool.hideResolved` setting. Signed-off-by: Seth House <[email protected]> Tested-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 966e671 commit 30bb808

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

mergetools/vimdiff

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ merge_cmd () {
1515
"$LOCAL" "$MERGED" "$REMOTE"
1616
fi
1717
;;
18+
*vimdiff1)
19+
"$merge_tool_path" -f -d \
20+
-c 'echon "Resolve conflicts leftward then save. Use :cq to abort."' \
21+
"$LOCAL" "$REMOTE"
22+
ret="$?"
23+
if test "$ret" -eq 0
24+
then
25+
cp -- "$LOCAL" "$MERGED"
26+
fi
27+
return "$ret"
28+
;;
1829
*vimdiff2)
1930
"$merge_tool_path" -f -d -c 'wincmd l' \
2031
"$LOCAL" "$MERGED" "$REMOTE"
@@ -52,7 +63,7 @@ exit_code_trustable () {
5263

5364
list_tool_variants () {
5465
for prefix in '' g n; do
55-
for suffix in '' 2 3; do
66+
for suffix in '' 1 2 3; do
5667
echo "${prefix}vimdiff${suffix}"
5768
done
5869
done

0 commit comments

Comments
 (0)