Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: menu-select doesn't respect COMPLETE_IN_WORD option
- X-seq: zsh-users 24924
- From: Alan <8fvebtoeq87@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: menu-select doesn't respect COMPLETE_IN_WORD option
- Date: Wed, 10 Jun 2020 23:26:00 -0400
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAH+w=7aR_BjcWsfRZOtSas+r9zHphf12-2f=-C0CYZHZ4b3gCg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- 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>
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."
However, after reading that section on _prefix more carefully, I tried
putting the _prefix completer further up in my completer list right after
_expand (in ~/.zshrc) like so:
zstyle ':completion:*' completer _expand _prefix _complete _ignored _prefix
...and now it works (mostly) the way I prefer! Namely, it acts like
expand-or-complete-prefix and ignores the suffix, even if the suffix
matches something. There is still some weirdness with slashes at the end of
directories, so that I get double slashes sometimes when the suffix starts
with a slash, but I suppose that's something I can live with.
(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.)
On Wed, Jun 10, 2020 at 10:33 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Tue, Jun 9, 2020 at 7:26 PM Alan <8fvebtoeq87@xxxxxxxxx> wrote:
> >
> > I found a partial solution by adding the _prefix completer (along with
> the complete_in_word option).
>
> Have you tried NOT setting the complete_in_word option?
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author