让 zsh 补全更像 bash / zsh 补全的最佳实践
使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我的 .zshrc 中有
setopt menucomplete
,这导致了所解释的行为。删除它修复了它。It appears I had
setopt menucomplete
in my .zshrc, which resulted in the explained behaviour. Removing it fixed it.