Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
I had posted a answer, but, this didn't worked as expected. Removed ^^ –  GarouDan May 1 '12 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 '12 at 13:41
    
Sorry, everyone. I have actually asked a wrong question. I meant autocorrection of spelling. –  Alexei Danchenkov May 1 '12 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 '12 at 14:37
    
I flagged the question for deletion and understand the caused confusion. Sorry for the trouble. –  Alexei Danchenkov May 1 '12 at 14:50
show 1 more comment

1 Answer

up vote 1 down vote accepted

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'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.