隐藏 zsh 自动补全中的某些选项
有几个命令具有我不经常使用的深奥选项。例如,git 有“check-attr”。然而,我经常使用“git checkout”,所以我想, 吉特奇 完成到 git 结账 或者显示一个没有 check-attr 的菜单。我可以使用 zstyle ... 忽略模式来做到这一点。
但是,如果没有其他匹配项,我仍然想完成“git check-attr”(如果我实际上确实想要运行 check-attr)。
似乎“隐藏”zstyle 适合我,但是如何在完成上下文中指定一个值(而不仅仅是一个标签)?即我想要类似的东西, zstyle ':completion:::git::' 隐藏模式 'check-attr'
这可能吗?
There are several commands that have esoteric options that I don't use often. For example, git has 'check-attr'. I use 'git checkout' very often, however, so I'd like,
git ch
to complete to
git checkout
or show a menu without check-attr in it. I can do this with zstyle ... ignored-patterns.
However, I'd still like to complete 'git check-attr' if nothing else matches (if I actually do want to run check-attr).
It seems that the 'hidden' zstyle is for me, but how can I specify a value (not just a tag) in the completion context? I.e. I'd like something like,
zstyle ':completion:::git::' hidden-patterns 'check-attr'
Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我真的不知道这是如何工作的,但结果是
git check
结果是git checkout
。将其添加到您的.zshrc
中:请参阅 http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Overview-1 获取一些信息,如果你能解密的话..
I don't really know how this works, but the result is that
git check<TAB>
results ingit checkout
. Add this to your.zshrc
:See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Overview-1 for some info, if you can decypher it..
像这样的事情应该可以解决问题:
Something like this should do the trick: