default bash tab-completion completes the common prefix until first ambiguity, and shows a list of all available matches. For example:
$ ls
foo_a1 foo_a2 foo_bb1 foo_bb2
$ ls ./foo_<TAB><TAB>
foo_a1 foo_a2 foo_bb1 foo_bb2
I would like to change this. Instead of showing the complete list of all available matching options, i would like to show all unique prefixes of the matches, but stopping at the next ambiguity. This way, the number of completions is smaller because completions do not include branching of matches at further points of ambiguity. In the above example, bash would recognize that after "foo_" there are 4 matches but only two unique completions ("a" and "bb") until next ambiguity ("1" vs "2"). The user would see this:
$ ls
foo_a1 foo_a2 foo_bb1 foo_bb2
$ ls ./foo_<TAB><TAB>
foo_a foo_bb
I've searched far and wide but no cigar. I read the manual of readline but there doesn't seem to be an option that implements this.
How can I achieve the desired behavior? Is it possible to configure bash to do the above? If not, does anyone know of an autocompletion tool that supports the above functionality? If so, is it possible to change the autocompletion mechanism to something else than readline?