gpt4 book ai didi

bash - show-all-if-ambiguous vs show-all-if-unmodified?

转载 作者:行者123 更新时间:2023-11-29 09:04:04 27 4
gpt4 key购买 nike

我找不到关于 Readline 选项 show-all-if-ambiguousshow-all-if-unmodified 之间区别的明确解释,以及是否它们影响不同的事物或相互排斥。关于这个主题的官方文档很少。

最佳答案

使用 man page 中的描述

show-all-if-unmodified

This alters the default behavior of the completion functions in a fashion similar to show-all-if-ambiguous. If set to ‘on’, words which have more than one possible completion without any possible partial completion (the possible completions don’t share a common prefix) cause the matches to be listed immediately instead of ringing the bell. The default value is ‘off’.

这意味着如果可以完成任何部分完成,那么它们将被填充并且不会显示所有完成。
如果没有要进行的部分完成,则显示所有完成。

show-all-if-ambiguous

This alters the default behavior of the completion functions. If set to ‘on’, words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell. The default value is ‘off’.

这意味着单词将被部分完成直到有歧义的地方AND将一步打印所有完成。


例子

假设我们有一个文件 abcd.txtabce.txt

使用
如果未修改则显示所有内容

打字

$ls a<tab>

会显示

$ls abc

然后再次按 Tab 键(因为没有部分完成)会导致

$ls abc
abcd.txt abce.txt
$ls abc

使用
show-all-if-ambiguous

打字

ls a<tab>

会显示

$ls a
abcd.txt abce.txt
$ls abc

因此一步执行这两个操作。

另请注意,show-all-if-ambiguous 会覆盖 show-all-if-unmodified,因此如果两者都设置为 on,则行为将是前者。

关于bash - show-all-if-ambiguous vs show-all-if-unmodified?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42192384/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com