Re: Is there a way to complete arguments with brace characters without using backslashes or quotes?

Bart Schaefer <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAH+w=7Y7cSf_gke3aWFUeWu+L63BufJ7DoRe-ocTk1ZaEDRLog@mail.gmail.com>
On Mon, Mar 24, 2025 at 7:35 AM Trevor Avant <[email protected]> wrote:
>
> Ok that setting gets me closer. However it doesn't get me all the way there

A quick check with _complete_debug shows that regardless of compadd -Q
or the setting of ignorebraces the internals are assigning

_lastcomp[prefix]='a\{'

which won't match 'a{' on the command line when you arrive at the second TAB.

So what you need is something along the lines of

#compdef myfun
PREFIX=${PREFIX//\\\{/\{}
compadd -Q a{b
compadd -Q a{c
compadd -Q a{cd
compadd -Q a{ce

You might be able to use (Q) instead of the // replacement, but that
could unquote too much.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.