Search code examples
cygwinmsysgitgit-bash

Why does Ctrl-Z on Windows Git bash shell fail?


I sometimes have to work in Windows, which often means using the Bash shell. If I am (for example) in vim (not gvim) with several files open, and I hit CtrlZ to briefly go back to the shell and do something before returning to vim, instead of suspending my vim process Git Bash creates a new DOS shell. This is the last thing I'd ever want. Googling turns up nothing useful (at this point in time - YMMV in my future). What is going on?


Solution

  • If I am (for example) in vim (not gvim) with several files open, and I hit ^Z to briefly go back to the shell and do something before returning to vim, instead of suspending my vim process Git Bash creates a new DOS shell.

    If you execute other processes in git bash, CTRL-Z won't suspend them either. Vim works around that and, instead, creates a shell to achieve a similar result. Vim is a tool in windows that doesn't require bash, rather the windows command prompt will be necessarily installed in a windows machine. I assume this is a safe choice of the windows binary program.

    This is the last thing I'd ever want. Googling turns up nothing useful (at this point in time - YMMV in my future). What is going on?

    My guess here is that vim has the CTRL-Z map to creating a DOS shell. If you want to create a bash shell instead, you can type:

    :!sh

    And you will be executing in a bash shell.