4

I have two files in a directory, test1 and test2. If I type

less te<TAB>

completion kicks in and expands te to test. If I hit TAB a second time nothing happens, and only when I press TAB a third time do I get offered the two matching filenames I might mean.

My question is, why does it take two presses after bash completes as far as it can, before I get offered my choices. Surely it would make more sense to be offered them after the second (in total) of the presses?

  • I agree with you but I don't think it's a big deal. I think it requires the third press to make sure you know there are multiple files that start with the same string. However if you already know that and just want to get it to spit out the names of those files it is annoying. – Jesse_b Jul 18 '17 at 14:35
  • you can add set show-all-if-ambiguous on to ~/.inputrc to get this behavior – Sundeep Jul 18 '17 at 14:58
  • Awesome. Reduces three TABs to one. Just the job. – user2567544 Jul 18 '17 at 15:02
  • using fish or friendly interactive shell you get many more options for tab completion. May be worth looking into, depending on how much you use it. I find it to be the most usefull environment. – Joe Jul 19 '17 at 20:56
6

Add this to ~/.inputrc

set show-all-if-ambiguous on

Quoting from arch wiki on this topic

Or you can set it such that a single tab will perform both steps: partially complete the word and show all possible completions if it is still ambiguous:

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.