When using git bash on Windows, pressing ESC key for multiple times, then the input will be blocked. And after several seconds or more, it might show below information:
MyHome+tomxue@DESKTOP-I23OD70 MINGW64 /d $ Display all 5486 possibilities? (y or n)
I dig out several reasons and some solutions, but all not work. How to solve it?
The prompt you see is Bash's tab-completion prompt, informing you that it's about to offer too many completion suggestions.
One of Bash's default key-bindings is:
$ bind -p | grep complete
"\e\e\000": complete
i.e. ESC ESC NUL
, which apparently also triggers on just ESC ESC
, i.e. pressing the Esc key twice.
Esc sends the ESC
byte, which is the same byte that starts the key-codes for various special keys; e.g. Shift-Tab would send the sequence ESC [ Z
and so on. I don't know whether ESC ESC NUL
is supposed to be the sequence for some special key, or if \e\e\000
is literally just Readline-speak for "Esc twice in a row" (as opposed to just \e\e
).
Regardless, this key binding is triggered by pressing EscEsc and invokes tab-completion, as complete
is the exact same action as if pressing the Tab key (which is listed by bind -p
under "\C-i"
).
And if you invoke tab-completion at an empty input, Bash will just try to offer every possible command on the system – which will take a few seconds, during which Bash might appear to hang because it's scanning your whole $PATH
for executables.