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
Vim/gVim works well for me.
>echo %EDITOR%
c:\Vim\Vim71\vim.exe
Building on Darren's answer, to use Notepad++ you can simply do this (all on one line):
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Obviously, the C:/Program Files/Notepad++/notepad++.exe
part should be the path to the Notepad++ executable on your system. For example, it might be C:/Program Files (x86)/Notepad++/notepad++.exe
.
It works like a charm for me.
This is the one symptom of greater issues. Notably that you have something setting TERM=dumb
. Other things that don't work properly are the less
command which says you don't have a fully functional terminal.
It seems like this is most commonly caused by having TERM set to something in your global Windows environment variables. For me, the issue came up when I installed Strawberry Perl some information about this is on the msysgit bug for this problem as well as several solutions.
The first solution is to fix it in your ~/.bashrc by adding:
export TERM=msys
You can do this from the Git Bash prompt like so:
echo "export TERM=msys" >> ~/.bashrc
The other solution, which ultimately is what I did because I don't care about Strawberry Perl's reasons for adding TERM=dumb
to my environment settings, is to go and remove the TERM=dumb
as directed in this comment on the msysgit bug report.
Control Panel/System/Advanced/Environment Variables... (or similar, depending on your version of Windows) is where sticky environment variables are set on Windows. By default, TERM is not set. If TERM is set in there, then you (or one of the programs you have installed - e.g. Strawberry Perl) has set it. Delete that setting, and you should be fine.
Similarly if you use Strawberry Perl and care about the CPAN client or something like that, you can leave the TERM=dumb
alone and use unset TERM
in your ~/.bashrc file which will have a similar effect to setting an explicit term as above.
Of course, all the other solutions are correct in that you can use git config --global core.editor $MYFAVORITEEDITOR
to make sure that Git uses your favorite editor when it needs to launch one for you.
I use Cygwin on Windows, so I use:
export EDITOR="emacs -nw"
The -nw
is for no-windows
, i.e. tell Emacs not to try and use X Window.
The Emacs keybindings don't work for me from a Windows shell, so I would only use this from a Cygwin shell... (rxvt is recommended.)
Here is a solution with Cygwin:
#!/bin/dash -e
if [ "$1" ]
then k=$(cygpath -w "$1")
elif [ "$#" != 0 ]
then k=
fi
Notepad2 ${k+"$k"}
If no path, pass no path
If path is empty, pass empty path
If path is not empty, convert to Windows format.
Then I set these variables:
export EDITOR=notepad2.sh
export GIT_EDITOR='dash /usr/local/bin/notepad2.sh'
EDITOR allows script to work with Git
GIT_EDITOR allows script to work with Hub commands
Source
Anyway, I've just been playing around with this and found the following to work nicely for me:
git config --global core.editor "'C:/Program Files/TextPad 5/TextPad.exe' -m"
I don't think CMD likes single-quotes so you must use double quotes "to specify the space embedded string argument".
Cygwin (which I believe is the underlying platform for Git's Bash) on the other hand likes both '
and "
; you can specify a CMD-like paths, using /
instead of \
, so long as the string is quoted i.e. in this instance, using single-quotes.
The -m
overrides/indicates the use of multiple editors and there is no need for a %*
tacked on the end.