zsh-users
 help / color / mirror / code / Atom feed
* Date format in prompt
@ 2020-11-22 21:58 Vin Shelton
  2020-11-22 22:22 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Vin Shelton @ 2020-11-22 21:58 UTC (permalink / raw)
  To: Zsh-Users List

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

Bart et al -

I've used prompt bart for as long as I can remember.  But I'm an ISO date
kind of guy, and I'd like to use %D{%Y-%m-%d} to get a four-digit year.
I've grovelled through the source code, but I can't figure out how to make
the change.  Is there an easy way to do what I want?

Thanks,
  Vin

-- 

*That's where you'll find me, over the horizon** Wading in the river,
reaching for that other shore*

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

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

* Re: Date format in prompt
  2020-11-22 21:58 Date format in prompt Vin Shelton
@ 2020-11-22 22:22 ` Bart Schaefer
  2020-11-24 12:50   ` Vin Shelton
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2020-11-22 22:22 UTC (permalink / raw)
  To: Vin Shelton; +Cc: Zsh-Users List

On Sun, Nov 22, 2020 at 2:00 PM Vin Shelton <acs@alumni.princeton.edu> wrote:
>
> I've used prompt bart for as long as I can remember.

Nice to know somebody else does. :-)

> But I'm an ISO date kind of guy, and I'd like to use %D{%Y-%m-%d} to get a four-digit year.  I've grovelled through the source code, but I can't figure out how to make the change.  Is there an easy way to do what I want?

It's this line in prompt_bart_ps1:

    date="%{$fg[%D]%}%D$rs"     # Prefer "%{$fg[%D]%}%W$rs" in the USA?

Just change to

    date="%{$fg[%D]%}%D{%Y-%m-%d}$rs"

If changing in real time in an interactive shell (e.g. with zed -f),
you then have to re-run prompt_bart_ps1


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

* Re: Date format in prompt
  2020-11-22 22:22 ` Bart Schaefer
@ 2020-11-24 12:50   ` Vin Shelton
  2020-11-24 19:54     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Vin Shelton @ 2020-11-24 12:50 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh-Users List

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

Excellent!  Thanks.  I copied prompt_bart_setup and changed the appropriate
line.

In the spirit of being greedy and improving the UX, how would you
parameterize this; how would you support US/normal/ISO date formats
(looking at the comment) in the same function?

Best,
  Vin

On Sun, Nov 22, 2020 at 5:22 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Sun, Nov 22, 2020 at 2:00 PM Vin Shelton <acs@alumni.princeton.edu>
> wrote:
> >
> > I've used prompt bart for as long as I can remember.
>
> Nice to know somebody else does. :-)
>
> > But I'm an ISO date kind of guy, and I'd like to use %D{%Y-%m-%d} to get
> a four-digit year.  I've grovelled through the source code, but I can't
> figure out how to make the change.  Is there an easy way to do what I want?
>
> It's this line in prompt_bart_ps1:
>
>     date="%{$fg[%D]%}%D$rs"     # Prefer "%{$fg[%D]%}%W$rs" in the USA?
>
> Just change to
>
>     date="%{$fg[%D]%}%D{%Y-%m-%d}$rs"
>
> If changing in real time in an interactive shell (e.g. with zed -f),
> you then have to re-run prompt_bart_ps1
>

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

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

* Re: Date format in prompt
  2020-11-24 12:50   ` Vin Shelton
@ 2020-11-24 19:54     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2020-11-24 19:54 UTC (permalink / raw)
  To: Vin Shelton; +Cc: Zsh-Users List

On Tue, Nov 24, 2020 at 4:52 AM Vin Shelton <acs@alumni.princeton.edu> wrote:
>
> In the spirit of being greedy and improving the UX, how would you parameterize this

I suppose the right way would be to add additional zstyles within the
:prompt-theme context.  The command line for "prompt [name] ..." is
already overloaded in a way that is not easily extensible.


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

end of thread, other threads:[~2020-11-24 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 21:58 Date format in prompt Vin Shelton
2020-11-22 22:22 ` Bart Schaefer
2020-11-24 12:50   ` Vin Shelton
2020-11-24 19:54     ` Bart Schaefer

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