The Computer Oracle

How to partially disable the zsh's autocorrect

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Island

--

Chapters
00:00 How To Partially Disable The Zsh'S Autocorrect
00:22 Accepted Answer Score 65
01:00 Answer 2 Score 38
01:20 Answer 3 Score 1
01:40 Answer 4 Score 0
01:51 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