zsh-users
 help / color / mirror / 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

zsh-users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-users

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-users zsh-users/ http://inbox.vuxu.org/zsh-users \
		zsh-users@zsh.org
	public-inbox-index zsh-users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git