如何完全禁用 zsh 自动更正?
我知道仅适用于某些命令的“nocorrect”选项。但我希望它完全关闭,这样当我输入“lear”而不是“clear”时,它不会提示进行更正。
我应该注意到“unsetopt Correctall”似乎对我没有任何作用
collin@mandalay ~
% unsetopt correctall
collin@mandalay ~
% lear
zsh: correct 'lear' to 'clear' [nyae]? n
zsh: command not found: lear
Run Code Online (Sandbox Code Playgroud)
仅放入以下几行.zshrc 对我来说不起作用。
unsetopt correct_all
unsetopt correct
Run Code Online (Sandbox Code Playgroud)
我注释掉这一行后它就起作用了:
ENABLE_CORRECTION="true"
Run Code Online (Sandbox Code Playgroud)
希望它也适合你。
在你的 .zshrc
#disable auto correct
unsetopt correct_all
Run Code Online (Sandbox Code Playgroud)
从 zsh (zshoptions) 的联机帮助页:
CORRECT (-0)
Try to correct the spelling of commands. Note that, when the HASH_LIST_ALL option is not set or when some directories in the path are not
readable, this may falsely report spelling errors the first time some commands are used.
CORRECT_ALL (-O)
Try to correct the spelling of all arguments in a line.
Run Code Online (Sandbox Code Playgroud)
所以正确的选项将只更正命令而不是行上的参数。
该corect_all选项将正确的命令就行所有参数。
啊哈!!...我明白我应该使用'unsetopt正确'而不是正确的_all
collin@mandalay ~
% unsetopt correct
collin@mandalay ~
% lear
zsh: command not found: lear
Run Code Online (Sandbox Code Playgroud)