让 zsh 补全更像 bash / zsh 补全的最佳实践

发布于 2025-01-03 22:09:12 字数 539 浏览 4 评论 0原文

使用 bash 我确实喜欢做这样的事情:

$ l
file15165
file23132
file31351
xyzfile
$ $CMD f<TAB>
(f gets completed to "file", I type "*", [23] or whatever)
$ $CMD file*<Enter>

这样我就可以确保命令在我想要的所有文件上执行。

当我尝试使用 zsh 执行此操作时,会发生这种情况:

$ l
file15165
file23132
file31351
xyzfile
$ $CMD f<TAB>
(f is completed to "file15165", I have to press <backspace> five times and then type "*")
$ $CMD file*<Enter>

这是非常无效的。现在如何使用 zsh 实现 bash 行为?或者 zsh 用户将如何尝试做我正在做的事情?

Using bash I did like to do something like this:

$ l
file15165
file23132
file31351
xyzfile
$ $CMD f<TAB>
(f gets completed to "file", I type "*", [23] or whatever)
$ $CMD file*<Enter>

This way I am sure the command is executed on all the files I want it to.

When I try to do this with zsh, this happens:

$ l
file15165
file23132
file31351
xyzfile
$ $CMD f<TAB>
(f is completed to "file15165", I have to press <backspace> five times and then type "*")
$ $CMD file*<Enter>

Which is quite ineffective. Now how can I achieve the bash behaviour using zsh? Or how would a zsh user attempt to do what I am doing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流殇 2025-01-10 22:09:12

看来我的 .zshrc 中有 setopt menucomplete ,这导致了所解释的行为。删除它修复了它。

It appears I had setopt menucomplete in my .zshrc, which resulted in the explained behaviour. Removing it fixed it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文