Re: Is there a way to complete arguments with brace characters without using backslashes or quotes?
Mikael Magnusson <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAHYJk3QORRtL51ePmPO00WoR=KtCY8c6zKiugeN0PVsM701erg@mail.gmail.com> |
On Mon, Mar 24, 2025 at 7:09 AM Trevor Avant <[email protected]> wrote: > > Thanks, I have reduced my zsh configuration to a minimal setup, but I'm still getting the same results. Here is my /home/trevor/.zshrc > > fpath=(/home/trevor/zsh_completions/ $fpath) > autoload -Uz compinit promptinit > compinit > promptinit > > and here is /home/trevor/zsh_completions/_myfun > > #compdef myfun > compadd -Q a{b > compadd -Q a{c > > and then I enter > > $ setopt ignore_braces > $ myfun <TAB> > > which completes to > > $ myfun a{ > > but then nothing happens on subsequent TAB presses (the two completion options aren't shown). If I change "a{b" and "a{c" to "abb" and "abc" then it works as expected (it shows the two options below prompt on the first TAB press, and then cycles through them on subsequent TAB presses). I am using Arch Linux and have tried a few different terminal emulators as well. I get the same result with that setup, it seems it worked for me because of this piece of configuration: zstyle ':completion:*' completer _complete _correct which is a little unexpected, at least to me. (my actual value for that key is _oldlist _expand _complete _correct fwiw, but the above is enough to reproduce the working result). My guess is the { gets parsed into some value other than a literal { at some point, and _correct cancels out this small discrepancy to show the wanted completions. -- Mikael Magnusson