I want bash to autocomplete cod<TAB> to codium (discarding other commands that might also start with cod)
Looking at the manual of the complete command, I found the -I flag which seems to be what I need.
I ended up with the following solution:
complete -I -F _command_completions -o bashdefault
function _command_completions() {
# cod<tab> completes to codium
[[ $2 == cod* ]] && COMPREPLY="codium"
}
which works, but I was wondering: Is there a more succinct way of achieving the same result?
For example, something like:
complete -I -W 'codium' cod
this causes the words: empty string, c, co, cod, codi, and codiu to complete to codium which is not what I want.