Skip to contentSkip to conversation

mergetool: put the cursor on the editable file for Vim

PATCH In review Markus Heidelberg 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mergetool: put the cursor on the editable file for Vim

When resolving conflicts, you only need to edit the $MERGED file. Put the cursor automatically into its window for vimdiff and gvimdiff to avoid doing <C-w>l every time.

---
 git-mergetool.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
git-mergetool.sh +7 -2
index b2d5375..00e1337 100755
@@ -200,14 +200,19 @@ merge_file () {
 	    fi
 	    status=$?
 	    ;;
-	meld|vimdiff)
+	meld)
 	    touch "$BACKUP"
 	    "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
 	    check_unchanged
 	    ;;
+	vimdiff)
+	    touch "$BACKUP"
+	    "$merge_tool_path" -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
+	    check_unchanged
+	    ;;
 	gvimdiff)
 	    touch "$BACKUP"
-	    "$merge_tool_path" -f "$LOCAL" "$MERGED" "$REMOTE"
+	    "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
 	    check_unchanged
 	    ;;
 	xxdiff)
Signature · 1 line
1.6.1.154.g97e2f
#1 lore raw
Quoted 3 lines · Markus Heidelberg

When resolving conflicts, you only need to edit the $MERGED file. Put the cursor automatically into its window for vimdiff and gvimdiff to avoid doing <C-w>l every time.

I think this is sensible.

I do not use vim, and I do not know if the patch does what it claims to do, though.

Tested-by
#2 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 3 lines · Markus Heidelberg

When resolving conflicts, you only need to edit the $MERGED file. Put the cursor automatically into its window for vimdiff and gvimdiff to avoid doing <C-w>l every time.

I think this is sensible.

I do not use vim, and I do not know if the patch does what it claims to do, though.

It does.

#3 lore raw
Quoted 7 lines · SZEDER Gábor
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Markus Heidelberg

When resolving conflicts, you only need to edit the $MERGED file. Put the cursor automatically into its window for vimdiff and gvimdiff to avoid doing <C-w>l every time.

Quoted 8 lines
Quoted 4 lines

I think this is sensible.

I do not use vim, and I do not know if the patch does what it claims to do, though.

It does.

Thanks, both.