Last Updated: October 07, 2020
·
28.84K
· natansh

Disabling Autocorrect in Zsh

The autocorrect feature in Zsh seems like a boon but more often than not, it annoys rather than helps.

Often one gets a warning akin to the following....
zsh: correct 'rspec' to 'spec' [nyae]? %
which can be really annoying.

To switch off this autocorrect for just one particular command, add the following line to .zshrc
alias vim='nocorrect <CommandName> '
nocorrect is a precommand modifier that prevents a spell check on any following words and must precede any other precommand modifier.

However, if you want to disable it completely, add this to .zshrc
unsetopt correct_all

7 Responses
Add your response

Thanks! Very helpful.

over 1 year ago ·

For newer versions of Oh My ZSH, I believe you have to use the following:

unsetopt correct

Sup @priestap. What a coincidence. ;-)

over 1 year ago ·

Neither of which seem to work for me....

over 1 year ago ·

There's a flag in .zshrc
DISABLE_CORRECTION="true"

works for me

over 1 year ago ·

DISABLE_CORRECTION="true" works for me, very handy!

over 1 year ago ·

setopt nocorrectall; works fine

over 1 year ago ·

I use:

$ zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)

Just in case someone else get bitten by this: set the option /after/ calling source oh-my-zsh.sh, otherwise the setting can get over-ridden by the oh-my-zsh scripts.

From my zshrc:

source $ZSH/oh-my-zsh.sh
# Options: These have to go after oh-my-zsh or they can get over-ridden
setopt CSH_NULL_GLOB
unsetopt correct_all
over 1 year ago ·