zsh-users
 help / color / mirror / code / Atom feed
* How to tweak the format of file-list completion?
@ 2020-12-20 18:37 Andy Spiegl
  2020-12-20 22:21 ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Spiegl @ 2020-12-20 18:37 UTC (permalink / raw)
  To: Zsh Users

Hi zsh fans,

I really like the long format in menu selection/completion and init it like this:
 zstyle ':completion:*' file-list list=20 insert=10

But I'm unhappy with the format of the completion info.
The file size is trimmed and the YEAR of the timestamp is missing.

Here is an example:

$ ls -l Dampf<TAB>
Completing files
-rw-rw-r--   1 andy      users     1181153 Mär 16 18:25 Dampfnudelblues.gif
-rw-rw-r--   1 andy      users    08272063 Dez 14 13:46 Dampfnudelblues.mp4
-rw-rw-r--   1 andy      users          32 Apr 24 22:08 Dampfnudelblues.STATE
-rw-rw-r--   1 andy      users        1354 Aug  3 15:17 Dampfnudelblues.txt

I'd rather see something like the real result of the ls command:

-rw-rw-r-- 1 andy users    1181153 2017-03-16 18:25:03 Dampfnudelblues.gif
-rw-rw-r-- 1 andy users 4308272063 2020-12-14 13:46:18 Dampfnudelblues.mp4
-rw-rw-r-- 1 andy users         32 2017-04-24 22:08:18 Dampfnudelblues.STATE
-rw-rw-r-- 1 andy users       1354 2016-08-03 15:17:59 Dampfnudelblues.txt

Is there a way to tweak these completions?
I haven't found the right parts in the zsh manual.

Thanks and Merry Christmas!
 Andy


-- 
 If your parents never had children, chances are you won't, either.
   (Dick Cavett)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2020-12-20 18:37 How to tweak the format of file-list completion? Andy Spiegl
@ 2020-12-20 22:21 ` Bart Schaefer
  2020-12-20 23:37   ` Andy Spiegl
  2020-12-28 22:58   ` Andy Spiegl
  0 siblings, 2 replies; 11+ messages in thread
From: Bart Schaefer @ 2020-12-20 22:21 UTC (permalink / raw)
  To: Zsh Users

On Sun, Dec 20, 2020 at 1:41 PM Andy Spiegl <zsh.Andy@spiegl.de> wrote:
>
> I really like the long format in menu selection/completion and init it like this:
>  zstyle ':completion:*' file-list list=20 insert=10
>
> But I'm unhappy with the format of the completion info.

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" at line 61 or thereabouts (may vary depending on
your version of zsh).

A more complete update would be to permit that format to be assigned
in a zstyle.  The question is whether to do it like

zstyle ':completion:*' \
  file-list list=20 insert=10 format="%b %e %H:%M"

(in which case a format= with no other values would be equivalent to
also asserting "all") or to add a new token ala

zstyle ':completion:*' \
  file-list-format "%b %e %H:%M"

(which has some precedent with "date-format"), or to us some new tag
with the "format" style (though I don't know what tag that would be,
offhand).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2020-12-20 22:21 ` Bart Schaefer
@ 2020-12-20 23:37   ` Andy Spiegl
  2020-12-28 22:58   ` Andy Spiegl
  1 sibling, 0 replies; 11+ messages in thread
From: Andy Spiegl @ 2020-12-20 23:37 UTC (permalink / raw)
  To: zsh-users

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
Veryl 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)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2020-12-20 22:21 ` Bart Schaefer
  2020-12-20 23:37   ` Andy Spiegl
@ 2020-12-28 22:58   ` Andy Spiegl
  2020-12-30 22:14     ` Bart Schaefer
  1 sibling, 1 reply; 11+ messages in thread
From: Andy Spiegl @ 2020-12-28 22:58 UTC (permalink / raw)
  To: zsh-users

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)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2020-12-28 22:58   ` Andy Spiegl
@ 2020-12-30 22:14     ` Bart Schaefer
  2021-01-02 23:01       ` Andy Spiegl
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Schaefer @ 2020-12-30 22:14 UTC (permalink / raw)
  To: Zsh Users

I presume you reposted this because nobody replied the first time.

On Mon, Dec 28, 2020 at 3:01 PM Andy Spiegl <zsh.Andy@spiegl.de> wrote:
>
> Does zstat have an option to output the file size in "human readable" format, by any chance?

No.  RTM?

[I wrote:]
> > A more complete update would be to permit that format to be assigned
> > in a zstyle.

There's a problem with this idea, which is that the style needs
somehow to specify both the format of values returned and how to
unpack it.  It's not obvious how to do the latter.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2020-12-30 22:14     ` Bart Schaefer
@ 2021-01-02 23:01       ` Andy Spiegl
  2021-01-02 23:16         ` Lawrence Velázquez
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Spiegl @ 2021-01-02 23:01 UTC (permalink / raw)
  To: zsh-users

> I presume you reposted this because nobody replied the first time.
Yes and No.  I was unsure whether my post made it to the list.
Because everytime I posted something in December I got a note saying that
it was forwarded to the list moderators.  I don't get why that happens.

> > Does zstat have an option to output the file size in "human readable" format, by any chance?
> No.  RTM?
Too bad.  Yep I (tried to) read the man pages but often times when I do that
I'm overwhelmed with the amount of (great!) information and get lost eventually. :-)
So I thought it won't hurt to ask some zsh experts - it wouldn't be the
first time I overlooked vital information.  I'm sorry if I hurt someone's feelings.

Have a great and happy and healthy new year!
 Andy

-- 
 The only time people dislike gossip is when you gossip about them.
   (Will Rogers)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2021-01-02 23:01       ` Andy Spiegl
@ 2021-01-02 23:16         ` Lawrence Velázquez
  2021-01-02 23:23           ` Andy Spiegl
  0 siblings, 1 reply; 11+ messages in thread
From: Lawrence Velázquez @ 2021-01-02 23:16 UTC (permalink / raw)
  To: Andy Spiegl; +Cc: zsh-users

> On Jan 2, 2021, at 6:01 PM, Andy Spiegl <zsh.Andy@spiegl.de> wrote:
> 
>> I presume you reposted this because nobody replied the first time.
> Yes and No.  I was unsure whether my post made it to the list.
> Because everytime I posted something in December I got a note saying that
> it was forwarded to the list moderators.  I don't get why that happens.

The mailing list software is assigning your messages a high spam
score, requiring moderator intervention. I don't know why or whether
there's anything you can do about that.

vq


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2021-01-02 23:16         ` Lawrence Velázquez
@ 2021-01-02 23:23           ` Andy Spiegl
  2021-01-03  0:11             ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Spiegl @ 2021-01-02 23:23 UTC (permalink / raw)
  To: zsh-users

> The mailing list software is assigning your messages a high spam score

Uff, I'd be really like to know what these criteria are?
Because strangely enough every once in a while people tell me that my mails
get high spam scores but I'm trying hard to avoid that and so far nobody
could give me a hint.  Usually *I* am the one who gives tipps to mail users
but maybe that's like a barber who can't give a hair cut to himself? :-)

Anybody out there who can solve this riddle?  (very much off-topic I must admit)

Thanks,
 Andy

-- 
 Life is an adventure, be regardful of it.  (Mother Teresa of Calcutta)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2021-01-02 23:23           ` Andy Spiegl
@ 2021-01-03  0:11             ` Bart Schaefer
  2021-01-03 18:06               ` Andy Spiegl
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Schaefer @ 2021-01-03  0:11 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

On Sat, Jan 2, 2021 at 3:57 PM Andy Spiegl <zsh.Andy@spiegl.de> wrote:
>
> > The mailing list software is assigning your messages a high spam score
>
> Uff, I'd be really like to know what these criteria are?

It appears the default spam rule doesn't like subject lines that end with a
question mark.  That seems a little extreme for a software users discussion
list.

X-Spamd-Result: default: False [1.00 / 50.00];
	 ARC_NA(0.00)[];
	 RCVD_VIA_SMTP_AUTH(0.00)[];
	 FROM_HAS_DN(0.00)[];
	 TO_MATCH_ENVRCPT_ALL(0.00)[];
	 MIME_GOOD(-0.10)[text/plain];
	 TO_DN_NONE(0.00)[];
	 RCPT_COUNT_ONE(0.00)[1];
	 NEURAL_HAM(-0.00)[-0.786,0];
	 RCVD_NO_TLS_LAST(0.10)[];
	 FROM_EQ_ENVFROM(0.00)[];
	 *SUBJECT_ENDS_QUESTION(1.00)[];*
	 ASN(0.00)[asn:3320, ipnet:87.128.0.0/10, country:DE];
	 MID_RHS_MATCH_FROM(0.00)[];
	 RCVD_COUNT_TWO(0.00)[2]
X-Spam-Level: *
X-Spam-Status: spam

[-- Attachment #2: Type: text/html, Size: 1264 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to tweak the format of file-list completion?
  2021-01-03  0:11             ` Bart Schaefer
@ 2021-01-03 18:06               ` Andy Spiegl
  2021-01-04  5:40                 ` [OT] " Daniel Shahaf
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Spiegl @ 2021-01-03 18:06 UTC (permalink / raw)
  To: zsh-users

> It appears the default spam rule doesn't like subject lines that end with a
> question mark.  That seems a little extreme for a software users discussion
> list.
According to a very helpful mail from Oliver Kiddle this cannot be the only
cause but there aren't really any other showstoppers in my mailserver config.

Anyway I made some small config changes and will try again now. :-)

@everybody else: please excuse this off-topic discussion!
I'll try to send helpful zsh related stuff soon to make up for it.

Thanks,
 Andy

-- 
 Those who would give up essential liberty to purchase a little temporary safety
 deserve neither liberty nor safety.  (Benjamin Franklin)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [OT] Re: How to tweak the format of file-list completion?
  2021-01-03 18:06               ` Andy Spiegl
@ 2021-01-04  5:40                 ` Daniel Shahaf
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Shahaf @ 2021-01-04  5:40 UTC (permalink / raw)
  To: Andy Spiegl; +Cc: zsh-users

Andy Spiegl wrote on Sun, 03 Jan 2021 19:06 +0100:
> > It appears the default spam rule doesn't like subject lines that end with a
> > question mark.  That seems a little extreme for a software users discussion
> > list.  
> According to a very helpful mail from Oliver Kiddle this cannot be the only
> cause but there aren't really any other showstoppers in my mailserver config.
> 
> Anyway I made some small config changes and will try again now. :-)
> 
> @everybody else: please excuse this off-topic discussion!
> I'll try to send helpful zsh related stuff soon to make up for it.

No worries!

(Yes, a change of subject line would've been a good idea, but that's spilt milk now.)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-04  5:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20 18:37 How to tweak the format of file-list completion? Andy Spiegl
2020-12-20 22:21 ` Bart Schaefer
2020-12-20 23:37   ` Andy Spiegl
2020-12-28 22:58   ` Andy Spiegl
2020-12-30 22:14     ` Bart Schaefer
2021-01-02 23:01       ` Andy Spiegl
2021-01-02 23:16         ` Lawrence Velázquez
2021-01-02 23:23           ` Andy Spiegl
2021-01-03  0:11             ` Bart Schaefer
2021-01-03 18:06               ` Andy Spiegl
2021-01-04  5:40                 ` [OT] " Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).