I have an alias for
alias tdA='todo -a'
I get the following in Zsh
tdA zsh: correct 'tdA' to 'tda' [nyae]?
How can you make Zsh not to suggest a fix for an alias?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
I've been using zsh for about 18 years now, and I must say I don't like the accepted solution. Here's why:
You need to figure out the source of the problem - determine why 'tda' is being offered as a correction option. What you have done is completely disabled spelling correction globally. This denies you some very nice functionality while trying to get rid of a tactical problem. It's like wanting to kill a fly in your house by setting off some dynamite just because you're too lazy to figure out where the fly swatter is: It may get rid of the problem, but you sacrifice a whole lot in return. :)
Until you can determine your zsh's current spell correction configuration, you should consider setting the value of the special shell variable $CORRECT_IGNORE to a value of 'tda'.
Here is the entry in the zsh man page:
CORRECT_IGNORE If set, is treated as a pattern during spelling correction. Any potential correction that matches the pattern is ignored. For example, if the value is `_*' then completion functions (which, by convention, have names beginning with `_') will never be offered as spelling corrections. The pattern does not apply the correction of file names, as applied by the CORRECT_ALL option (so with the example just given files beginning with `_' in the current directory would still be completed).
This should help get you by until you can determine the source of where 'tda' is actually coming from.
Also note that you can use the precommand modifier 'nocorrect' to disable spelling correction on a per-command basis. You could use this to do something a little hacky, but effective:
alias tdA="nocorrect tda" alias tda="todo -a"
aliases are just tokens substituted into the command-line by zsh, and those substitutions are re-scanned for additional aliases. So the above should work.
Hopefully these alternatives give you a more selective approach to solving your problem, while still giving you the benefit of zsh's rich spelling correction features.