Is there a way to control bash completion to pick only a few commands instead of everything in the path, aliases and functions? We can set a default handler for empty command line but when the first letter is typed, bash goes for completing it with PATH, aliases and functions. Is there a way to customise the completion for the command search?
Example:
$m[tab] mycmd1 mycmd2 mycmd3
instead of the commands that match in PATH, aliases and functions.
The following should remove the "word" from the completion list. Completion functions just return a bash array and you can manipulate it to contain whatever you like:
I don't see any way to get a completion to work for all commands but I suppose you could always do something like this if you really need to:
Now, you can tweak the above code sections to get what you are trying to find (i.e. only some commands). Hint.