I've got auto-completion working for bash. When I type part of a program name, and then TAB, I get the full command. Works like expected, no complaints.However on my setup I've got an alias defined called flexo (which logs me in to a machine with the same name). When I type fleTAB I only get flex, because that's a perfectly valid program on the machine. How do I instruct complete to ignore this specific completion? In other words I want fleTAB to complete to flexo and ignore flex completely. Thanks.
How to have autocomplete ignore a specific completion
bash;autocomplete
Monkeying with the algorithm for tab complete to rip a couple items out of the pool is more complicated than you imagine. It actually can be done but it's not easy, efficient to use or recommended.Instead, @jasonwryan was on the right track that you should come up with something else for your command name. However instead of trying to stay with one word, the name of a server as a command name, I recommend you switch models to a multi word model like the rest of Unix. Tab completion for command names is quite different than tab completion for arguments, the latter is quite easy.Setup a short easy alias like 's' or whatever your connect alias is, but don't include the host name. Then setup a custom completion routine for that command that ONLY autocompletes to host names like:alias s=sshcomplete -F _known_hosts_real sYou could also create a custom function for this:alias s=ssh_my_hosts() {    type compopt &>/dev/null && compopt -o nospace    COMPREPLY=( $( compgen -S = -W 'flexo mexo dexo' -- $cur) )}complete -F _my_hosts s