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

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

1 Answer

up vote 18 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: 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:

unsetopt correct_all

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

share|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
In the new versions unsetopt correct_all changed to unsetopt correct – antitoxic Apr 3 at 19:58

Your Answer

 
discard

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.