4 ms·
Other people have shared improvements to Bash's default autocomplete behaviour; here's mine, specifically addressing the criticisms that you have to hit tab twi
by bewuethr 7y ago
Other people have shared improvements to Bash's default autocomplete behaviour; here's mine, specifically addressing the criticisms that you have to hit tab twice and the pollution of terminal history:
# Complete unambiguously on first tab, then show completions
set show-all-if-unmodified on
(These settings go into your ~/.inputrc file.)
This means that if I hit tab for the first time, Bash will autocomplete as far as the completion isn't ambiguous; single keypress, no history pollution.
If I then hit tab again, I get a list of the possible completions.
The other single biggest improvement over default behaviour for me is this:
# Replace common prefix with ellipsis for completion
set completion-prefix-display-length 2
This will make the list of completions omit the part they all have in common.
The combined behaviour is then like this: for a directory with a few files,
$ ls
file1 file2 file3
I can start typing:
$ cat f
Now, hitting tab (just once) gets me the unambiguous part:
$ cat file
Hitting it again shows me the possible completions with the common part replaced by an ellipsis:
$ cat file
...1 ...2 ...3
$ cat file