I am new to zsh and I like it a lot, especially with oh-my-zsh plugin. I installed oh-my-zsh with its default values and can't figure out how to turn off autocompletion for specific commands, that I often use, such as: sudo mc or sudo gem update. The thing is that I have .mc directory and .gem directory and zsh proposes corresponding autocompletions (for .mc and .gem).

Generally I would like to config zsh so that sudo is not considered a separate command (which it is not) with the following as a params. Is there a config for that?

  • I had posted a answer, but, this didn't worked as expected. Removed ^^
    – GarouDan
    May 1, 2012 at 12:57
  • Do you want to disable autocompletion, or actually have autocompletion still work for the command run under sudo, as if the word sudo weren't there?
    – mattdm
    May 1, 2012 at 13:41
  • Sorry, everyone. I have actually asked a wrong question. I meant autocorrection of spelling. May 1, 2012 at 14:15
  • Then please start a new question. Your description still mentions your original problem in parts, and is now very unclear. Not to mention uther has spent time answering the question you originally asked.
    – Mikel
    May 1, 2012 at 14:37
  • 1
    @AlexeiDanchenkov Well, if there's a right answer we might as well leave it; I just changed it back to the original question May 1, 2012 at 15:15

1 Answer 1


Ignoring directory patterns is fairly painless. You can add the following to your ~/.zshrc.

The first line ignores .mc and .gem patterns after issuing cd [TAB]. The next line ignores them after issuing sudo [TAB].

zstyle ':completion:*:cd:*' ignored-patterns '(*/)#.mc' '(*/)#.gem'
zstyle ':completion:*:sudo:*' ignored-patterns '(*/)#.mc' '(*/)#.gem'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .