Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Questions about completion matchers
- X-seq: zsh-users 27225
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Cc: Oliver Kiddle <opk@xxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Questions about completion matchers
- Date: Sat, 9 Oct 2021 15:39:58 -0700
- Archived-at: <https://zsh.org/users/27225>
- In-reply-to: <CAHLkEDumxFh=7bLx0geSoL3K-OF9LF447FEzujp_QX1MZ33SMg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAHLkEDuT6iGYEivrHcML-dEaTMJUiGy-p39=2=kDEw1gL0i=Ew@mail.gmail.com> <20296-1632661753.678317@ipjb.25sX.Whnd> <CAHLkEDv=+A7BXF6nKADNJDnd-zLW5baZ8xU3erp28it+jAKNrg@mail.gmail.com> <CAH+w=7ZpxduSrwZ101JoRJfEkE_xAnNfd_Lo6BUkaQmuxsiu5A@mail.gmail.com> <CAHLkEDumxFh=7bLx0geSoL3K-OF9LF447FEzujp_QX1MZ33SMg@mail.gmail.com>
On Sat, Oct 9, 2021 at 3:12 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> On Sat, Oct 9, 2021 at 7:23 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > * l:|$lpat=$tpat -> [[ $trial = *${~lpat}* ]] &&
> > ${word/#$~lpat/$~tpat}
>
> Perhaps I'm mistaken, but aren't you mixing up $lpat and $lanchor
> here?
Well, sort of, yes. See Oliver's more recent message. A better
description of what's happening is that the matcher transforms the
word from the command line into a pattern, and then that pattern is
compared to every one of the trial candidates, and then pieces of the
trial candidates are extracted and merged with the word from the
command line to generate the list of possible replacements for that
word. It's never as simple as a string substitution on the word
itself taken directly from the patterns in the matcher.
> How about changing the docs to just literally state the transformation
> that each matcher applies?
Because it's not a literal transformation. Matchers don't transform,
they create a comparison between the command line and the compadd
strings and define which parts of the command line can be replaced by
what parts of the compadd strings when that comparison finds a match.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author