I am using 'git bash' for Windows (from 'git for Windows') which in turn consists of mingw+msys and a mintty.

This mingw installation contains a 'vi' editor which works in the mintty. Good.

Question: Are there any other editors available which run in the mintty terminal emulation window?

The problem is that apparently the mintty terminal window is not a real tty but just uses stdin/stdout to communicate with the application (editor).

Nano just says: 'Redirection is not supported.'. Emacs -nw just says emacs: 'standard input is not a tty'

I would be happy with any basic text editor which has a better user interface than vi.

  • 2
    Not really answering what you're asking, but you can use graphical editors if you want. Also, using the built-in Windows console (which admittedly is crap until Win10) should work with nano, etc. (not sure about emacs, but you said a better interface than vi anyhow...) – CBHacking Oct 14 '15 at 22:08
  • Yes, thanks. I am using emacs for Windows and this does mostly what I want. Somehow the overhead of starting emacs evaporated in the past 20 years. :-) – Johannes Overmann Oct 19 '15 at 10:02

Picking up on JFM's answer to a the question How to run emacs in CLI mode under mintty in windows?

JFM points out that the native win32 emacs wants to talk to a Windows console window, not to an actual tty (so the error message we see is misleading, the opposite of what it states is the problem!)

The two immediate options I'm thinking about is

  1. Remove the -nw from emacs -nw in my ~/.gitconfig file and just live with the pop-up emacs; or
  2. Swap from Git Bash to the normal windows command line where the emacs -nw setting works fine.

The advantage for me of the first option is that the Git bash terminal is available across Windows and Mac (and Linux). The advantage of the second option for me is that I can use all my Windows command line knowledge.

| improve this answer | |
  • Thanks. This kind of confirms that there is no solution for running emacs inside the Git bash window. I am using variant 1. (emacs GUI). – Johannes Overmann Jan 22 '18 at 9:38

The answer https://stackoverflow.com/a/38544424/2416627 points in the right direction – use the winpty command that is distributed with Git for Windows as a prefix for the actual editor command. This works with Emacs and presumably also with Nano.

For Emacs, another workaround is also needed, though, due to a problem with the handling of the Ctrl-C key combination.

First, here is how to configure Emacs in text mode as the default editor – assuming that Emacs has been installed by unpacking the Zip distribution to C:\Program\Emacs:

git config --global core.editor 'winpty /c/Program/Emacs/bin/emacs -nw'

However, in order to be able to quit Emacs using the standard C-X C-C shortcut, the following line must be put in a file named .emacs at the top level of the Windows user profile location of the logged-in user:

(global-set-key [24 pause] (quote save-buffers-kill-terminal))

The same applies to any other shortcuts containing C-C that one wishes to be able to use – i.e. they must be given additional shortcut mappings where "pause" is used in the definition instead of C-C.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.