7

Is there a way to set a minimum number of characters to Bash's tab completion?

My reason is that I often accidentally press the tab key on an empty command line and it takes forever to load the command list.

2

You can tell bash/completion to NOT try completion for an empty entry through the use of the 'no_empty_cmd_completion' shell option.

In your .bashrc (or alternate), enter this command:

shopt -s no_empty_cmd_completion

Exit your bash session and restart (or 'source .bashrc'), and pressing TAB at an empty prompt will just ignore you.

You can type the command at the prompt if you want to try it out beforehand.

| improve this answer | |
0

I often accidentally press the tab key on an empty command line and it takes forever to load the command list.

complete -E 

can solve above problem, but to figure out the character specific limit is difficult, since it might be inside libraries.

Since we have not specified either directory ( -d ) or file ( -f ), it will not search for neither file nor directory.

| improve this answer | |

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.