Thread (10 messages) flat view 10 messages, 5 authors, 2016-08-13

Re: using gvim as editor on Windows

From: Jacob Helwig <hidden>
Date: 2016-06-15 22:48:23

On Fri, Mar 5, 2010 at 23:06, Tait [off-list ref] wrote:
I'd prefer to use gvim as an editor on Windows XP instead of vim. (I also
prefer it as a difftool, but that's a separate issue.) Gvim releases
the terminal when it launches, which git doesn't like too much. So I
create gvimf.cmd in my path and use it for core.editor. Gvimf.cmd is
quite simple; it calls:
       start "dummy" /b /wait "C:\Program Files\Vim\vim72\gvim.exe" %*

In .gitconfig:
[core]
       editor = gvimf.cmd

This works well enough for git commit. However, git rebase -i is not
happy. It errors:
       C:\path to\repo> git rebase -i HEAD~10
       The system cannot find the file dummy.
       Could not execute editor

Okay, I can fix that. I change core.editor to "cmd \\/c gvimf.cmd". (This
is the same pattern I use for gvim as a difftool.) Now my .gitconfig has:
[core]
       editor = cmd \\\\/c gvimf.cmd

Git rebase is happy, but git commit is not. It errors:
       C:\path to\repo> git commit
       'OMMIT_EDITMSG' is not recognized as an internal or external command,
       operable program or batch file.
       error: There was a problem with the editor 'cmd \\/c gvimf.cmd'.
       Please supply the message using either -m or -F option.

In the selfish hope to avoid work, has anyone else already encountered
and solved how to use gvim as an editor?

Tait
Use the -f (stay in the foreground) flag.  I haven't tried this in
Windows, but that's how I've used it in Linux.

[core]
    editor = gvim -f
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help