Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The autocorrection function of zsh is very helpful for me but it does't always gives a proper result.

~$ sudo vim somefile
zsh: correct 'vim' to '.vim' [nyae]? 

Yet what I want is something like the a never option that can stop it to correct commands like those forever.

How can I do this?

share|improve this question
up vote 42 down vote accepted

You can inform zsh that it should not autocorrect on specific commands by aliasing them with the prefix 'nocorrect' in your .zshrc (example here:

alias vim='nocorrect vim' 

Alternatively -- if this whitelisting process becomes too frustrating -- you can switch autocorrect off entirely with the following in your .zshrc.

For newer versions of zsh use:

 unsetopt correct

for older versions of zsh use:

 unsetopt correct-all

Amended to add: here is a previous discussion on this subject - Exceptions to zsh correctall feature?

share|improve this answer
While this works for when vim command is at the start, but doesn't work for commands such as bundle exec cucumber <some_specific_feature> && bundle exec rspec <some_specific_spec>. I've added an alias for rspec. Any tips? – Martin Foot Oct 3 '12 at 8:55
@MartinFoot: if you use oh-my-zsh the bundler plugin may help you: – brafales Nov 19 '12 at 16:03
In the new versions unsetopt correct_all changed to unsetopt correct – antitoxic Apr 3 '13 at 19:58
@antitoxic: I wanted to look up what "new version" in terms of version numbers means, but even in today's git checkout (zsh 5.0.2+31433) the zshoptions manpage states for CORRECT_ALL: Try to correct the spelling of all arguments in a line. Furthermore, both man entries for CORRECT and CORRECT_ALL didn't changed at least since 2008. So I am missing your point; can you please explain what you leads to your statement?! – mpy May 30 '13 at 10:01
I'd like to add: load order matters! Make sure you add unsetopt after sourcing oh-my-zsh... Wasted a lot of my time. – oma Aug 26 '13 at 19:04

I think I found a better answer to this.

Im not sure about versions and whatnot, but it seems correct_all is supposed to correct commands and arguments, while correct corrects only commands, therefore eliminating this annoying behaviour.

This is what I have in my config files

unsetopt correct_all  
setopt correct
share|improve this answer
This is the actual answer. correct-all doesn't appear to be a real option in any documentation I can find, nor in Real Life. It's correct_all. Thanks! – Jamey May 23 '14 at 2:10
I have setopt correctall from – zzapper Jun 6 '14 at 16:15
Thank god! Commands-only works so much better. – Kevin May 16 at 18:51

I had the problem when using rspec via zeus, and I'd like to keep auto-correct settings as they seem to work for everything else except rspec, so I never tried any of the other suggestions above.

What I had to do was nocorrect zeus itself :

alias zeus='nocorrect zeus'

share|improve this answer

In case you use oh-my-zsh:

unsetopt correct_all

will disable all autocorrection.

Setting aliases for exceptions (see link below) does not do the trick for me.

share|improve this answer

Your Answer


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.