Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 489
K Raphael Avatar asked Nov 07 '22 11:11

K Raphael


1 Answers

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]
like image 107
hardeep Avatar answered Nov 15 '22 05:11

hardeep