Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use gvim for svn commit messages under Windows?

Tags:

vim

windows

svn

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?

like image 230
usta Avatar asked Jan 13 '11 15:01

usta


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.

like image 136
zundr Avatar answered Nov 13 '22 22:11

zundr


This answer was written for Git, but should directly apply.

To make this work, try the following.

  1. Create a one-line batch file (named svn_editor.bat) which contains the following:
  2. "path/to/gvim.exe" --nofork "%*"
  3. Place svn_editor.bat on your PATH.
  4. 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.

like image 3
Tim Henigan Avatar answered Nov 13 '22 21:11

Tim Henigan


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
like image 1
DrAl Avatar answered Nov 13 '22 21:11

DrAl