Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh CORRECT option is unaware of AUTO_CD and CDABLE_VARS



> 2019/08/26 22:59、Cameron Steffen <cam.steffen94@xxxxxxxxx> wrote:
> 
> Is there a way to make the CORRECT option aware of AUTO_CD and
> CDABLE_VARS? In this example, I would expect correction to not be
> triggered. Could this be a bug?
> 
>> setopt autocd
>> setopt cdablevars
>> setopt correct
>> vimz=/var
>> vimz
> zsh: correct 'vimz' to 'vim' [nyae]?

The patch below seems to fix this problem.
I hope this has no obvious bad side effects.


diff --git a/Src/utils.c b/Src/utils.c
index 46cf7bcf6..02fbdb351 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3147,6 +3147,8 @@ spckword(char **s, int hist, int cmd, int ask)
 	}
 	if (access(unmeta(guess), F_OK) == 0)
 	    return;
+	if (cd_able_vars(guess))
+	    return;
 	best = spname(guess);
 	if (!*t && cmd) {
 	    if (hashcmd(guess, pathchecked))





Messages sorted by: Reverse Date, Date, Thread, Author