Re: Selectively sorting directory by date in completion

Bart Schaefer <[email protected]> Sat, 21 Mar 2026 21:26:58 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAH+w=7ZQ=JLn=9LL+m5sbRt2ZitcQLTBS+nHETnaRHqbg5qvXQ@mail.gmail.com>
On Sat, Mar 21, 2026 at 9:14 PM Mikael Magnusson <[email protected]> wrote:
>
> > So here is the solution I came up with: I redefined `_path_files` by
> > symlinking `~/.local/share/zsh/site-functions/_path_files_old` to
> > `/usr/share/zsh/functions/Completion/Unix/_path_files` and by creating
> > the file `~/.local/share/zsh/site-functions/_path_files`
>
> You might be able to make good use of zstyle -e here, where the value
> of the style will be evaluated and then the parameter $REPLY will be
> used as the style value

It's got to be the $reply array rather than the $REPLY scalar, I think.

zstyle -e ':completion:*' file-sort \
  '[[ ${${~PREFIX:-$PWD}:a} = (/tmp|$HOME/(dl|tmp)) ]] && \
    reply=(date)'