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

4 messages from 2009-01-17 to 2009-01-18. Participants: Markus Heidelberg, Junio C Hamano, SZEDER Gábor.
Thread: https://gitlist.dev/t/17230

## Markus Heidelberg, 2009-01-17 21:28

Subject: [PATCH] mergetool: put the cursor on the editable file for Vim
Message-ID: <200901172228.45450.markus.heidelberg@web.de>
URL: https://gitlist.dev/e/200901172228.45450.markus.heidelberg%40web.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

```

## Junio C Hamano, 2009-01-18 01:35

Subject: Re: [PATCH] mergetool: put the cursor on the editable file for Vim
Message-ID: <7v7i4t4crp.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7i4t4crp.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <200901172228.45450.markus.heidelberg@web.de>

```
Markus Heidelberg <markus.heidelberg@web.de> writes:

> 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.

```

## SZEDER Gábor, 2009-01-18 14:18

Subject: Re: [PATCH] mergetool: put the cursor on the editable file for Vim
Message-ID: <20090118141854.GA25155@neumann>
URL: https://gitlist.dev/e/20090118141854.GA25155%40neumann
In-Reply-To: <7v7i4t4crp.fsf@gitster.siamese.dyndns.org>

```
On Sat, Jan 17, 2009 at 05:35:22PM -0800, Junio C Hamano wrote:
> Markus Heidelberg <markus.heidelberg@web.de> writes:
> 
> > 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.

Tested-by: SZEDER Gábor <szeder@ira.uka.de>

```

## Junio C Hamano, 2009-01-18 20:29

Subject: Re: [PATCH] mergetool: put the cursor on the editable file for Vim
Message-ID: <7vbpu4we6l.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpu4we6l.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090118141854.GA25155@neumann>

```
SZEDER Gábor <szeder@ira.uka.de> writes:

> On Sat, Jan 17, 2009 at 05:35:22PM -0800, Junio C Hamano wrote:
>> Markus Heidelberg <markus.heidelberg@web.de> writes:
>> 
>> > 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.
>
> Tested-by: SZEDER Gábor <szeder@ira.uka.de>

Thanks, both.

```
