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?


You can inform zsh that it should not autocorrect on specific commands by aliasing them with the prefix 'nocorrect' in your .zshrc (example here: http://dzen.geekmode.org/wiki/wiki.cgi/-main/ZshConfiguration):

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?

| improve this answer | |
  • 1
    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: coderwall.com/p/weixga – brafales Nov 19 '12 at 16:03
  • 1
    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
| 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 zsh.sourceforge.net/Intro/intro_16.html – zzapper Jun 6 '14 at 16:15
  • 1
    You are my hero! – Martin K Jan 10 '17 at 8:21
  • If you use oh-my-zsh, ensure you put the two lines after source $ZSH/oh-my-zsh.sh otherwise it does not work. It seems oh-my-zsh will reset option correct_all. – Matt Apr 27 '17 at 19:50

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'

| improve this answer | |

I was able to disable autocorrection using


I am using zsh version 5.7.1

| improve this answer | |
  • That's probably not doing what you think it does. – kissgyorgy Jan 12 at 17:36

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.


| improve this answer | |
  • No, it won't. See man zshoptions. – kissgyorgy Jan 12 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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