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?
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..
Something like this should do the trick:
zstyle ':completion::complete:*:git:*' ignored-patterns check-attr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With