zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Questions about completion matchers
Date: Wed, 22 Sep 2021 16:25:41 -0700	[thread overview]
Message-ID: <CAH+w=7a7KWM3Sj-YP-GLHr8r9mM4MY_-2_03-yqMJzVtnGqjYg@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDuT6iGYEivrHcML-dEaTMJUiGy-p39=2=kDEw1gL0i=Ew@mail.gmail.com>

On Tue, Sep 21, 2021 at 2:23 AM Marlon Richert <marlon.richert@gmail.com> wrote:
>
> How can I make a matcher that completes the right-most part (and only
> the right-most part) of each subword?

I would not try to do this with a matcher specification ... someone
else (Oliver?) may be able to give a more accurate answer, but I don't
think matchers are very good at splitting up words unless there is an
anchor character ("." or "-" for example) to subdivide the words.  I
know there's an example that purports to handle a similar situation,
but the more you want to constrain it ("only the right-most part") the
uglier it gets.

Instead I'd probably write a completer function that creates a
modified words array using match-words-by-style, then compset the
appropriate prefix and suffix.  But I haven't gone very far down that
road.

> * What is the exact difference between l:lanchor||ranchor=tpat and
> r:lanchor||ranchor=tpat ?

Again I'm not the ultimate expert here, but "lanchor" always has to
appear on the command line and with "l:" it has to appear to the left
of the matched substring (but not inside it) and with "r:" it has to
appear to the right of the matched substring (but again not inside
it).  In both cases ranchor has to appear in the potential completion
result (the "trial completion") but might bound a range on the command
line if it does match there.

In practice I've nearly always seen these to be empty strings.

> * Why do the examples in the manual add r:|=* to the end of each
> matcher? This appears to make no difference at all.

All of my real-life uses are "r:|=**" ... I don't know the answer to this one.

> * How are the match descriptions inside a matcher evaluated
> and what causes the difference between these?

I believe they're applied left to right and each one constrains the
possibilities seen by the next, based on what's already on the command
line when you invoke completion.


  reply	other threads:[~2021-09-22 23:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  9:23 Marlon Richert
2021-09-22 23:25 ` Bart Schaefer [this message]
2021-09-26 13:09 ` Oliver Kiddle
2021-10-08 22:38   ` Marlon Richert
2021-10-09 16:23     ` Bart Schaefer
2021-10-09 22:12       ` Marlon Richert
2021-10-09 22:39         ` Bart Schaefer
2021-10-10 11:17           ` Marlon Richert
2021-10-09 21:59     ` Oliver Kiddle
2021-10-10 12:05       ` Marlon Richert
2021-10-10 20:14         ` Marlon Richert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7a7KWM3Sj-YP-GLHr8r9mM4MY_-2_03-yqMJzVtnGqjYg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=marlon.richert@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).