Is there a way to stop “Ctrl+C” from closing a tab when running Git Bash in Console2?

7

1

My ultimate goal is to have a terminal with Unix commands (e.g. ls instead of dir), color, and working keys in my Windows 7 machine. My current attempt at getting this to work is using Git Bash in Console2. I created a new tab with:

Title: Git Bash
Icon: C:\Program Files\Git\mingw64\share\git\git-for-windows.ico
Shell: C:\Windows\System32\cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i
Startup dir: C:\Users\evesforeva

Git Bash gives me the Unix commands. Adding ansicon gives me color. But when I type Ctrl+C, it closes the whole tab. I need it to stop processes like rails server without closing the tab. I also tried different combinations of swapping C:\Windows\System32\cmd.exe for C:\Windows\SysWOW64\cmd.exe and C:\Program Files\Git\bin\bash.exe for C:\Program Files\Git\bin\sh.exe and got the same results.

A direct solution to the problem would be much appreciated, but if that's not possible, I’ll take anything that provides Unix commands, color, and working keys. I also tried using Git Bash directly with minTTY, but the arrow keys don't work and irb exits after one command. I even went as far as trying to install Ubuntu. My HP Probook 650 G1 won't let me change any of the BOIS settings, so neither dual-booting nor VirtualBox worked.

How do I prevent Ctrl+C from closing the tab when running Git Bash in Console2?

Eva

Posted 2015-09-19T01:41:20.363

Reputation: 203

Answers

4

Try the following

  1. "cmd.exe /c" in your command is superfluous. Remove it completely.
  2. Update to the latest git-for-windows. It has git-cmd.exe wrapper. To run it properly there are switches, something like "git-cmd.exe --cmd=/use/bin/sh.exe"
    1. Not sure about Console... Check your associated action for Ctrl+C hotkey. It may be configured improperly.
  3. Why do not give a try to ConEmu?

Maximus

Posted 2015-09-19T01:41:20.363

Reputation: 19 395

ConEmu is perfect! Worked for me too! – sridhar249 – 2016-02-08T17:40:06.853

8

This worked for me:

Shell: C:\Windows\SysWOW64\cmd.exe /c "C:\Program Files\Git\usr\bin\bash.exe" --login -i

The bash.exe inside \Git\usr\bin seems to handle Ctrl-C normally.

*64bit Win7 using Git for Windows 2.6.1

budji

Posted 2015-09-19T01:41:20.363

Reputation: 91

1Thanks for a proper answer! Possibly something to do with the new mintty shell. – StAlphonzo – 2015-12-12T15:08:42.457

Don't forget the quotes, and don't forget to clear the CTRL-C command from the Console2 Hotkeys (clear, assign, ok) – dvtoever – 2016-01-21T14:13:22.107