Zsh – How to Ignore Specific Command from Autocomplete

autocompletezsh

Is it possible to tell zsh to not autocomplete certain commands when using TAB completion ?

EXAMPLE:

I type chm <tab> and zsh completion offers me two options:

chmem  chmod

I never use chmem. Instead of having two options, I would prefer to have chm automatically completed to chmod.

Best Answer

You can do:

zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem'

If you needed to do more than one ignored pattern, you would do it like this:

zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem|chcpu|chcon'