Under *nix I can set SVN_EDITOR
to gvim --nofork
to do the trick, but that doesn't seem to work under Windows. Is there any solution for that?

- 6,699
- 3
- 22
- 39
-
In what way doesn't it work? What exactly did you do, what happened and what did you expect to happen? Your question is a little vague... – DrAl Jan 13 '11 at 15:36
-
If I set `SVN_EDITOR` to `gvim --nofork` and then do `svn ci`, svn doesn't wait for gvim to quit but instead issues this error message and exits: `svn: Commit failed (details follow): svn: system('"gvim --nofork" svn-commit.tmp') returned 1`. Similarly if I set `SVN_EDITOR` to just `gvim`. The problem is now solved thanks to zundr. Thanks everyone for your attention. – usta Jan 13 '11 at 17:05
-
I suspected that was what you meant, I just wasn't completely sure. Either a batch file or adjusting `guioptions` in `vimrc` should work in that case. – DrAl Jan 13 '11 at 17:18
3 Answers
If you have installed the batch files (c:\windows\gvim.bat), just set EDITOR
to gvim -f
, the batch file processes the -f argument and sets the no-fork option.
The trick in the batch file is running START /WAIT path\to\gvim.exe %*
(see the /WAIT argument).
If you don't have the batch files, just create a new one with the command above, and set EDITOR
to the newly create batch file.

- 156
- 3
-
1Yes, I do have batch files installed and so following your advice I've set `SVN_EDITOR` to `gvim -f` and it worked like a charm. Thanks very much for your suggestion and explanation! – usta Jan 13 '11 at 16:55
This answer was written for Git, but should directly apply.
To make this work, try the following.
- Create a one-line batch file (named
svn_editor.bat
) which contains the following: "path/to/gvim.exe" --nofork "%*"
- Place
svn_editor.bat
on yourPATH
. - Set
SVN_EDITOR=svn_editor.bat
With this done, SVN should correctly invoke the gvim executable.
NOTE 1: The --nofork option to gvim insures that it blocks until the commit message has been written.
NOTE 2: The quotes around the path to gvim is required if you have spaces in the path.
NOTE 3: The quotes around "%*" are needed just in case git passes a file path with spaces.

- 1
- 1

- 60,452
- 11
- 85
- 78
-
Thanks, I tried your suggested approach and it works well. I think I'm going to use zundr's approach however as it's easier to setup and easier to memorize. But thanks anyway, +1 from me ;) – usta Jan 13 '11 at 17:15
If the problem is passing parameters to prevent forking to gvim (your question was a little vague), then you can either create a batch file that calls gvim with the required parameters or you could simply add the following to your vimrc
(NOT gvimrc
) and point SVN_EDITOR
at gvim.exe
:
set guioptions+=f
This tells vim not to fork when creating the GUI and has the advantage of not having to mess around with batch files. For more information, see:
:help gui-fork

- 70,428
- 10
- 106
- 108
-
I'm sorry you found my question vague. I was asking how to teach svn to use gvim when `svn commit` is invoked without `-m` argument, and in a way that will work with no issues. – usta Jan 13 '11 at 16:59
-
I wasn't sure whether you meant that svn wasn't looking at SVN_EDITOR, whether the path to gvim was wrong, whether the file provided was wrong (e.g. a space issue as fixed by Tim Henigan) or whether it was a forking issue (as fixed by Tim Henigan's, zundr's and my answers). – DrAl Jan 13 '11 at 17:20