I\'m trying out Git on Windows. I got to the point of trying \"git commit\" and I got this error:
Terminal is dumb but no VISUAL nor
Edit: After updating to Vim 7.3, I've come to the conclusion that the cleanest and easiest way to do this is:
Add Vim's main folder to your path (right click on My Computer → Properties → Advanced → Environment Variables)
Run this:
git config --global core.editor "gvim --nofork '%*'"
If you do it this way, then I am fairly sure it will work with Cygwin as well.
Original answer:
Even with a couple of Vim-related answers, I was having trouble getting this to work with gVim under Windows (while not using a batch file or %EDITOR% or Cygwin).
What I eventually arrived at is nice and clean, and draws from a few of the solutions here:
git config --global core.editor \
"'C:/Program Files/Vim/vim72/gvim.exe' --nofork '%*'"
One gotcha that took me a while is these are not the Windows-style backslashes. They are normal forward slashes.
WordPad!
I'm happy using Vim, but since I'm trying to introduce Git to the company I wanted something that we'd all have, and found that WordPad seems to work okay (i.e. Git does wait until you're finished editing and close the window).
git config core.editor '"C:\Program Files\Windows NT\Accessories\wordpad.exe"'
That's using Git Bash on msysgit; I've not tried from the Windows command prompt (if that makes any difference).
I found a a beautifully simple solution posted here - although there may be a mistake in the path in which you have to copy over the "subl" file given by the author.
I am running Windows 7 x64, and I had to put the "subl" file in my /Git/cmd/
folder to make it work.
It works like a charm, though.
I use Git on multiple platforms, and I like to use the same Git settings on all of them. (In fact, I have all my configuration files under release control with Git, and put a Git repository clone on each machine.) The solution I came up with is this:
I set my editor to giteditor
git config --global core.editor giteditor
Then I create a symbolic link called giteditor which is in my PATH. (I have a personal bin directory, but anywhere in the PATH works.) That link points to my current editor of choice. On different machines and different platforms, I use different editors, so this means that I don't have to change my universal Git configuration (.gitconfig), just the link that giteditor points to.
Symbolic links are handled by every operating system I know of, though they may use different commands. For Linux, you use ln -s. For Windows, you use the cmd built-in mklink. They have different syntaxes (which you should look up), but it all works the same way, really.
This is working for me using Cygwin and TextPad 6 (EDIT: it is also working with TextPad 5 as long as you make the obvious change to the script), and presumably the model could be used for other editors as well:
File ~/.gitconfig
:
[core]
editor = ~/script/textpad.sh
File ~/script/textpad.sh
:
#!/bin/bash
APP_PATH=`cygpath "c:/program files (x86)/textpad 6/textpad.exe"`
FILE_PATH=`cygpath -w $1`
"$APP_PATH" -m "$FILE_PATH"
This one-liner works as well:
File ~/script/textpad.sh
(option 2):
"`cygpath "c:/program files (x86)/textpad 6/textpad.exe"`" -m "`cygpath -w $1`"
I managed to get the environment version working by setting the EDITOR variable using quotes and /
:
EDITOR="c:/Program Files (x86)/Notepad++/notepad++.exe"