阻止ZSH尝试更正命令


8
$ knife cookbook download recipe
zsh: correct 'cookbook' to 'cookbooks' [nyae]?

我怎样才能让zsh停止尝试将食谱更正为食谱?

cookbooks是我在其中运行命令的目录,因此我理解为什么这样做,但是cookbook是命令行的有效部分。

Answers:


13

如果您不想完全禁用更正,则应定义一个别名:

alias knife='nocorrect knife'

8

您可以添加setopt nocorrectall; setopt correct~/.zshrc文件以禁用此行为。它仍然对命令有效,但对参数无效。


1

另一个选择是CORRECT_IGNORE_FILE在.zshrc文件中定义的变量中包含要忽略的文件名或模式列表。对于您的情况,请添加CORRECT_IGNORE_FILE="cookbooks"到您的.zshrc文件中。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.