隐藏 zsh 自动补全中的某些选项

发布于 2024-09-30 12:34:16 字数 369 浏览 12 评论 0原文

有几个命令具有我不经常使用的深奥选项。例如,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 技术交流群。

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

发布评论

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

评论(2

2024-10-07 12:34:16

我真的不知道这是如何工作的,但结果是 git check 结果是 git checkout。将其添加到您的 .zshrc 中:

zstyle ':completion::complete:git:*:*' ignored-patterns 'check*-*'

请参阅 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 in git checkout. Add this to your .zshrc:

zstyle ':completion::complete:git:*:*' ignored-patterns 'check*-*'

See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Overview-1 for some info, if you can decypher it..

往昔成烟 2024-10-07 12:34:16

像这样的事情应该可以解决问题:

zstyle ':completion::complete:*:git:*' ignored-patterns check-attr

Something like this should do the trick:

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