Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using the correctall option in zsh, and I am generally quite happy with it. There are, however, few situations where I find this feature highly annoying.

For example, lets say I have a file file1.tex and I want to create a copy called file2.tex which I will then edit to make some changes. I will do

cp file1.tex file2.tex

only to be told by zsh that I might have misspelled file2.tex and if I want to correct it to file1.tex.

What happens is this: when zsh tries to check spelling, it looks in the current directory for a file called file2.tex, does not find it, but finds file1.tex and assumes that I misspelled file1.tex, and asks me if I want to correct that.

That happens to me so often that I actually unset the correctall option, and use only correct. However, bad typist as I am, I really miss the correctall option. Thus my my question:

Is there any way to tell zsh not to correct the last argument of the cp command?

(I know I could get the result I want by modifying completion settings for cp, but I still want to have completion on the last argument, I just don't want to autocorrect it.)

share|improve this question
    
I think you can get the result by modifying completion settings for cp, without losing completion. Look at the section about zstyle in the zshcompsys man page, particularly the corrections tag. Be sure to report back if you understand what command to issue (I don't). –  Gilles Mar 1 '11 at 23:40
    
@Gilles: Thanks! That will at least give me a direction in which to look. Next time I have few days (or perhaps weeks, or months?) with nothing to do, I will see if i can make any sense of it. :) –  Jan Hlavacek Mar 2 '11 at 1:31

1 Answer 1

up vote 9 down vote accepted

Try these.

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

etc.

That's not totally on point as it will disable application of correctall for the entire command, but I think it's a good compromise. Completion (including the _correct completer) and expansion, for example, will still work.

share|improve this answer
    
Thanks. Although it is not exactly what I was looking for, it seems to be the closest thing that's actually possible. –  Jan Hlavacek Apr 23 '11 at 2:57

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.