13

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.)

2
  • 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). Mar 1, 2011 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. :) Mar 2, 2011 at 1:31

1 Answer 1

15

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.

1
  • Thanks. Although it is not exactly what I was looking for, it seems to be the closest thing that's actually possible. Apr 23, 2011 at 2:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .