3

Lets say I have an alias for grep. When I use zsh completion, it will offer grep twice (once as command, once as alias):

gr<TAB>
grep
grep

I found I can use ignored-patterns specifically for aliases for commands or for builtins or functions"

zstyle ':completion:*:*:-command-:*:aliases' ignored-patterns 'grep'
zstyle ':completion:*:*:-command-:*:commands' ignored-patterns 'foo'
zstyle ':completion:*:*:-command-:*:builtins' ignored-patterns 'something'
zstyle ':completion:*:*:-command-:*:functions' ignored-patterns 'something'

but there are some completions I need to ignore which are neither of these categories:

which coproc
coproc: shell reserved word

also, if I have variable defined, it completed the variable:

foo=1

fo<TAB>
foo

how can I specify "shell reserved words" and variables to be ignored ?

UPDATE:

after further research, I found the general syntax for zstyle:

':completion:<function>:<completer>:<command>:<argument>:<tag>'

and what I am looking for is the proper tag name for "reserved word", such as coproc

1 Answer 1

1

There is a far easier way to get rid of duplicate entries coming from different tags: Put the tags in the same group.

zstyle ':completion:*:*:-command-:*:*' \
    group-name -command-

In any case, the tag for reserved words is… 🥁 reserved-words. You can see that in the code here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.