Zsh Mailing List Archive
Messages sorted by:
Re: menu-select doesn't respect COMPLETE_IN_WORD option
- X-seq: zsh-users 24930
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Alan <8fvebtoeq87@xxxxxxxxx>
- Subject: Re: menu-select doesn't respect COMPLETE_IN_WORD option
- Date: Sat, 13 Jun 2020 20:07:20 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAL7A0-PMSV6ZM5USa55mfH4=xaV0heCL7Uqe31B8RJxcgTBWjg@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- List-unsubscribe: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAL7A0-P6qmPidGHiYy6=1jmUY6T=X4xktbp1Wv2CBO0CX2xJRQ@mail.gmail.com> <CAH+w=7Z8F5-9g2isMha2B0gUU-fVYirezaEWr1AnupQRep6A6A@mail.gmail.com> <CAL7A0-NSfM7fRZS4491teaUJGBkQW46RC+JtwS7PtHM4RX1mPg@mail.gmail.com> <CAL7A0-POtHWPReN0Z3z+Z7x7+1=aa+WfXvozKex=-mzJr0mQJQ@mail.gmail.com> <CAH+w=7aR_BjcWsfRZOtSas+r9zHphf12-2f=-C0CYZHZ4b3gCg@mail.gmail.com> <CAL7A0-PMSV6ZM5USa55mfH4=xaV0heCL7Uqe31B8RJxcgTBWjg@mail.gmail.com>
On Wed, Jun 10, 2020 at 8:26 PM Alan <8fvebtoeq87@xxxxxxxxx> wrote:
> Yes, I've tried *not* setting the complete_in_word option, but then the _prefix completer doesn't work. See this (rather bizarre in my opinion) explanation from http://zsh.sourceforge.net/Guide/zshguide06.html:
> "One gotcha with the _prefix completer: you have to make sure the option COMPLETE_IN_WORD is set. That may sound counter-intuitive: after all, _prefix forces completion not to complete inside a word. The point is that without that option, completion is only ever tried at the end of the word, so when you type <TAB> in the middle of <prefix><suffix>, the cursor is moved to after the end of the suffix before the completion system has a chance to see what's there, and hence the whole thing is regarded as a prefix, with no suffix."
As you've noticed, I think this advice only applies when _prefix is
attempted after _complete, or possibly when the ALWAYS_TO_END option
is set (which by default it is not). I don't think COMPLETE_IN_WORD
is relevant unless you want prefixes completed only when no other
possibility is found (which is probably what it was thought most
people would expect).
If someone has a chance to test a few combinations and update that
doc, please go ahead. I might but I don't know how soon.
> (I'm not actually entirely clear how the completer ordering works, so not sure if I need that second _prefix instance at the end, but whatever works I guess. If someone would care to shed some light on the matter, that would be good too.)
The completion process happens in a nested loop: For each function in
the completer list, try it with each of the patterns in the
matcher-list. Ordinarily this loop stops as soon as one of the
completers returns zero (true), which is why the order is important,
but the _all_matches completer can change that.
The only reason to put _prefix in the list twice would be to implement
the example of doing so that appears in the documentation for _prefix.
Messages sorted by: