Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Selectively sorting directory by date in completion



On Sun Mar 22, 2026 at 5:26 AM CET, Bart Schaefer wrote:
>> You might be able to make good use of zstyle -e here, where the value
>> of the style will be evaluated [...]
>
> zstyle -e ':completion:*' file-sort \
>   '[[ ${${~PREFIX:-$PWD}:a} = (/tmp|$HOME/(dl|tmp)) ]] && \
>     reply=(date)'

Hey, thanks to both of you. I missed the `zstyle -e` option. That's
pretty clean.

>> [...] $REPLY will be used as the style value
>
> It's got to be the $reply array rather than the $REPLY scalar, I think.

Yeah, according to the manual it's `$reply`. (See zshmodules(1).)




Messages sorted by: Reverse Date, Date, Thread, Author