Skip to content

Commit

Permalink
mergetools: add vimdiff3 mode
Browse files Browse the repository at this point in the history
It's similar to the default, except that the other windows are hidden.
This ensures that removed/added colors are still visible on the main
merge window, but the other windows not visible.

Specially useful with merge.conflictstyle=diff3.

Signed-off-by: Felipe Contreras <[email protected]>
Acked-by: David Aguilar <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
felipec authored and gitster committed Apr 22, 2014
1 parent 0bc85ab commit 7c147b7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions mergetools/gvimdiff3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
. "$MERGE_TOOLS_DIR/vimdiff"
14 changes: 12 additions & 2 deletions mergetools/vimdiff
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ merge_cmd () {
"$merge_tool_path" -f -d -c 'wincmd l' \
"$LOCAL" "$MERGED" "$REMOTE"
;;
gvimdiff3|vimdiff3)
if $base_present
then
"$merge_tool_path" -f -d -c 'hid | hid | hid' \
"$LOCAL" "$REMOTE" "$BASE" "$MERGED"
else
"$merge_tool_path" -f -d -c 'hid | hid' \
"$LOCAL" "$REMOTE" "$MERGED"
fi
;;
esac
check_unchanged
}

translate_merge_tool_path() {
case "$1" in
gvimdiff|gvimdiff2)
gvimdiff|gvimdiff2|gvimdiff3)
echo gvim
;;
vimdiff|vimdiff2)
vimdiff|vimdiff2|vimdiff3)
echo vim
;;
esac
Expand Down
1 change: 1 addition & 0 deletions mergetools/vimdiff3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
. "$MERGE_TOOLS_DIR/vimdiff"

0 comments on commit 7c147b7

Please sign in to comment.