-2

I would like to fill out a command which expects a file argument, by alternating the files in the current directory. So I followed Gilles' reply

Bind the Tab key to the menu-complete command instead of the default complete. Put the following line in your ~/.bashrc:

bind '"\C-i": menu-complete'

Does "\C-i" represent the Tab key? Where is this specified? I thought "\C-i" representing Ctrl-i.

After I run the command bind '"\C-i": menu-complete', the Tab key doesn't seem to work for any purpose (including any kind of auto completion) in bash. Do I miss understand the purpose of the command?

How can I undo the command, i.e. make the Tab key work for the default style of auto completion again? For recovery, I have run the following commands, some by accident, and none of them seem to work for recovery:

bind -u 'menu-complete'
bind -u 'complete'
bind '"TAB": complete'
bind '"\TAB": complete'
3

Ctrl+I is in every way identical to Tab (it's what the Tab key generates). I tried following Gilles' suggestion and I can still tab complete filenames etc., though it behaves slightly different now (each press on Tab gives the next suggested completion).

To reset it to the default, use

bind '"\C-i": complete'
  • Thanks. (1) Where is "Ctrl+i is in every way identical to Tab" specified? (2) bind '"\C-i": complete' doesn't recover the default setting – Tim Jun 24 at 10:31
  • @Tim A Tab character is ASCII code 9, this is what Ctrl+i generates. Ctrl+j generates a character with ASCII code 10 (linefeed, or the same as Enter). Ctrl+a generates a character with code 1. i happens to be the 9th character of the alphabet, which is why Ctrl+i generates this character. Why this is so seems to be outside the scope of this question. – Kusalananda Jun 24 at 10:39

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.