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

Trevor Avant <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <CADpHffFJWp6Yg+ezuWOKx2NzpbcGOQcVaZ7zp+yzuwbxiqSc4Q@mail.gmail.com>
Awesome, thank you! I've been trying to figure this out for so long, I'm
ecstatic that I found a solution. I was trying a similar replacement with
BUFFER in my zshrc but couldn't get it to work. I also couldn't figure out
how to debug this, so thanks for the info about the _complete_debug option.

On Fri, Mar 28, 2025 at 5:24 PM Bart Schaefer <[email protected]>
wrote:

> 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.