The Computer Oracle

How to partially disable the zsh's autocorrect

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Orient Looping

--

Chapters
00:00 Question
00:31 Accepted answer (Score 63)
01:26 Answer 2 (Score 34)
01:57 Answer 3 (Score 1)
02:25 Answer 4 (Score 0)
02:43 Thank you

--

Full question
https://superuser.com/questions/439209/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#zsh #autocorrect

#avk47



ACCEPTED ANSWER

Score 65


You can inform zsh that it should not autocorrect on specific commands by aliasing them with the prefix 'nocorrect' in your .zshrc (example here: https://web.archive.org/web/20110213094724/http://dzen.geekmode.org:80/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?




ANSWER 2

Score 38


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



ANSWER 3

Score 1


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'




ANSWER 4

Score 0


I was able to disable autocorrection using

ENABLE_CORRECTION="false"

I am using zsh version 5.7.1