Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Although I love zsh, and find its spelling correction useful, it is annoying that it corrects things that obviously should not be corrected. For instance, I just executed

mv iso_ iso

and it replied

zsh: correct 'iso' to 'iso_' [nyae]?

Think about it. Correcting 'iso' to 'iso_' would mean I was trying to execute

mv iso_ iso_

which would NEVER make sense. Therefore this is really a design flaw in zsh, and should be corrected across the board. But, given that it hasn't been (at least in the version I'm using) and it isn't likely to be, is there some setting to correct it? I would prefer a non-kludgey way of fixing it. Aliases for mv, for example, are kludgey.

share|improve this question
add comment

2 Answers

Well, don't use the correct_all option if you don't like what it does.

FWIW, it is NOT set by default. There's a popular configuration on the net (I won't say which) that thinks for some reason that it's a fun idea to set that option for everybody... yet, it doesn't make sense for many MANY applications, though. It makes every command line argument subject to filename spelling correction... That's insane.

To cut a long story short: Only setopt correct and NOT setopt correctall.

If you need help with the spelling of filenames, zsh's completion system can help you with its _approximate and _correct completers. Details can be found in the zshcompsys(1) manual page.

share|improve this answer
add comment

There is a kludgey way to fix this. To correct the behavior of mv, cp, and mkdir, add this to your .zshrc file:

alias mv='nocorrect mv'
alias cp='nocorrect cp'
alias mkdir='nocorrect mkdir'

This is not an ideal fix for several reasons, not the least of which is that there may be some times when you do want spelling correction for a mv command. For instance, if you were trying to execute:

mv directory_a/sub/sub/some_file directory_b/sub/sub/

but you misspelled one of the directories and ended up typing

mv directory_a/sub/sub/some_file directry_b/sub/sub/

spelling correction might have been helpful. (This is obviously a contrived example, but you get the point.)

share|improve this answer
add comment

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.