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

Re: Selectively sorting directory by date in completion



On Sat, Mar 21, 2026 at 9:14 PM Mikael Magnusson <mikachu@xxxxxxxxx> 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)'




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