$ bind -p | grep 'complete$'
"\C-i": complete
"\M-\e": complete
This shows that the default key binding of Meta+Esc (and Ctrl+i) in Emacs command line editing mode is the Readline function complete
. The Meta key is usually Esc on keyboards without an explicit Meta key. The Readline documentation for this function says
Attempt to perform completion on the text before point. The
actual completion performed is application-specific. Bash, for
instance, attempts completion treating the text as a variable
(if the text begins with $
), username (if the text begins with
~
), hostname (if the text begins with @
), or command (including
aliases and functions) in turn. If none of these produces a
match, filename completion is attempted. Gdb, on the other
hand, allows completion of program functions and variables, and
only attempts filename completion under certain circumstances.
Regarding your comment to Anthon's answer: No, pressing Esc twice is not the same as pressing Tab generally (unless it's in a program that maps them both to the same action, as Readline does by default). However Ctrl+i is the same as Tab, just like Ctrl+[ is the same as Esc. This means that you can do completion with Ctrl+[ Ctrl+[ in bash
if you wish, as long as double Esc is bound to the Readline complete
function. This is handy if you're working at a VT220 terminal, for example, which lacks the Escape key: