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

Re: How to tweak the format of file-list completion?



On 2020-12-20, 14:21, Bart Schaefer wrote:

> For the nonce you will have to copy Completion/Unix/Type/_list_files
> into an earlier slot in your $fpath and edit the format string that is
> passed to "zstat"
Found it, thanks!
I changed these two statements:
  zstat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1
  listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f")

to

  zstat -s -H stat -F "%Y-%m-%d %H:%M" - "$dir$f" >/dev/null 2>&1
  listfiles+=("$stat[mode] ${(r:8:)stat[uid]} ${(r:8:)stat[gid]} ${(l:10:)stat[size]} $stat[mtime] $f")

A lot better now!
Does zstat have an option to output the file size in "human readable" format, by any chance?
Like "ls -h".

> A more complete update would be to permit that format to be assigned
> in a zstyle.  The question is whether to do it like
Very cool!  I'd be happy with any of these options.

Thanks!
 Andy


-- 
 Every person takes the limits of their own field of vision for the limits of the world.
   (Arthur Schopenhauer)




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