K Raphael
K Raphael

Reputation: 851

bash tab completion - do not reprint options + prompt

When doing tab-completion within bash (e.g. cd dir_ <TAB>), subsequent hits of Tab cause the list of matching options to be re-printed, once per hit of the Tab key (picture below). Each new line is me hitting Tab once, and the options (and prompt) re-printed.

bash tab completion

Now, in zsh for example, this behavior is disabled. In the picture below, I have typed cd dir_ and then hit tab REPEATEDLY. As desired, the prompt and the available completion options do not re-print, but just stay as-is, below the current prompt.

zsh tab completio

Is this at all possible with bash? The screen filling up with all the options when repeatedly hitting Tab is quite annoying.

EDIT
3 years later and i'm happy to report i'm finally using zsh and this is no longer bugging me

Upvotes: 6

Views: 1147

Answers (1)

hardeep
hardeep

Reputation: 195

Add these two lines to your bashrc

bind 'set show-all-if-ambiguous on'
bind 'TAB:menu-complete'

and you should be ok..But i see you have already moved to zsh.

More about bind(a bash built-in):

bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name]
     [-r keyseq] [-x keyseq:shell-command] 
     [keyseq:readline-function | readline-command]

Upvotes: 2

Related Questions