Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: _complete: insert unambiguous when globbing
On Thu, Jan 06, 2022 at 02:52:21 +0100, Tomasz Pala wrote:
>> unsetopt globcomplete
>> zstyle ':completion:*' completer _complete _match _expand
>> zstyle ':completion::match:*' insert-unambiguous true
>
> Smart one! This is nice, but this time I got other issues:
>
> $ rpm --*er[tab]
>
> without glob_complete, this method of finding options for SOME commands
> stops working. What's the difference between ps --* and ls --* that the
> latter still works?
This is weird - it's broken only when both styles are set:
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format ':%d'
> And back to my example:
>
> $ touch 2021.12.29-14:41:02.xz 2021.12.29-19:41:02.xz 2021.12.30-03:41:03.xz 2021.12.30-14:41:04.xz 2021.12.30-19:41:02.xz 2021.12.31-03:41:02.xz 2021.12.31-14:41:04.xz 2021.12.31-19:41:03.xz
> $ ls *04[tab]
> - this one is much nicer than my version, goes directly to:
> $ ls 2021.12.3-14:41:04.xz (note the suffix)
> with cursor __^__ placed here, on dash. However, unless I move cursor
> left+right manually, pressing tab second time moves cursor to the end
> with uncompletable line...
This exposes some general issue - I don't know which part inserts
unambiguous SUFFIX into the ZLE, but obviously it should be done only
when completeinword is set.
> And following one fails miserably...
> $ ls *z[tab]
> $ ls 2021.12.-
>
> See the dash at the end? From now on, no completion... This problem is
This is probably some deeper bug somewhere, still happens with --norcs
followed by settings from this thread.
> There is still one issue with coloring completions, that works fine with
> my approach, but seems to be stuck on _oldlist:
>
> highlights='${PREFIX:+=(*/|)(#bi)($PREFIX|$PREFIX:t)(?)(*(${LASTSEARCH})*)#*==1;32=1;31==1;32}':${(s.:.)LS_COLORS}
> zstyle -e ':completion:*:*' list-colors 'reply=( "'$highlights'" "ma=44;1;33")'
>
> With _oldlist in action the colors are not updated after prepending the
> unambiguous part.
In my solution compstate[old_list]=keep is set on second tab strike and
the colors are recalculated at this point; is it because this is done
AFTER "# Stuff we always do to clean up" which restores ZLS_COLORS?
Any way to simulate this for _oldlist?
And one more final note - I said all of those sacrifice pattern from ZLE
(which might get people angry if they loose some hand-crafted fine-tuned
one and are unfamiliar with undo), however without globcomplete this
pattern is also lost.
--
Tomasz Pala <gotar@xxxxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author