git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] mergetool: put the cursor on the editable file for Vim

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jan 17, 2009, 21:28 UTC
Message-ID
<200901172228.45450.markus.heidelberg@web.de>

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.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 git-mergetool.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index b2d5375..00e1337 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -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)
-- 
1.6.1.154.g97e2f
Next: Junio C Hamano
Message 1 of 4 in “mergetool: put the cursor on the editable file for Vim”
  1. mergetool: put the cursor on the editable file for VimMarkus Heidelberg, Jan 17, 2009
  2. Junio C HamanoJan 18, 2009
  3. SZEDER GáborJan 18, 2009
  4. Junio C HamanoJan 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.