I use msysgit and I'd like to have gvim as my git editor.
I use cygwin bash instead of git bash.
Running
$ /cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe
starts gvim. But if I set this as git editor:
$ git config core.editor /cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe
and run commit I get:
/cygdrive/c/Program Files (x86)/Vim/vim73/gvim.exe: -c: line 0: syntax error near unexpected token `('
I then add escaped backslashes where needed:
$ git config core.editor /cygdrive/c/Program\\\ Files\\\ \\\(x86\\\)/Vim/vim73/gvim.exe
This still gives me:
/cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe: /cygdrive/c/Program Files (x86)/Vim/vim73/gvim.exe: No such file or directory
error: cannot run /cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe: No such file or directory
error: There was a problem with the editor '/cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe'.
The thing is, I can copy the string from after "cannot run" and paste it and it runs. I guess it could be caused by either the spaces or the parentheses in Program Files (x86) (what on earth were they thinking?).
Since cygwin seems to handle it ok I figured I could create a symlink in say /usr/local/bin, as it is in my $PATH and set
$ git config core.editor /usr/local/bin/gvim
I confirm that /usr/local/bin/gvim starts gvim. Still, running a commit gives me:
error: cannot spawn /usr/local/bin/gvim.exe: No such file or directory
error: There was a problem with the editor '/usr/local/bin/gvim.exe'.
Unsetting core.editor and trying
$ export GIT_EDITOR=/usr/local/bin/gvim.exe
gives me the same error.
This SO answer suggest that I use a script to open the editor.
I remove the soft link gvim.exe from /usr/local/bin and
$ cat > gvim
#!/bin/sh
/cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/gvim.exe
$ chmod u+x gvim
I test run the script, it works, gvim starts.
$ gvim
Unfortunately when I run commit I get an error
$ git commit
error: cannot spawn /usr/local/bin/gvim: No such file or directory
error: There was a problem with the editor '/usr/local/bin/gvim'.
What can I do to get to use gVim as git editor? Has anybody tried it? Have I made mistakes? I must admit to being a novice when it comes to linux.
which gvim
?