zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Vin Shelton <acs@alumni.princeton.edu>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: Date format in prompt
Date: Sun, 22 Nov 2020 14:22:42 -0800	[thread overview]
Message-ID: <CAH+w=7a6BMat+jGwAfmxowV=xGOUqG1rGUy-ZWo5GX+iyM9BdA@mail.gmail.com> (raw)
In-Reply-To: <CACeGjnVOfjuNXwLeU4Ns7wkjB4BLNsFTT0QwxpjKbH3B=OyadQ@mail.gmail.com>

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


  reply	other threads:[~2020-11-22 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-22 21:58 Vin Shelton
2020-11-22 22:22 ` Bart Schaefer [this message]
2020-11-24 12:50   ` Vin Shelton
2020-11-24 19:54     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7a6BMat+jGwAfmxowV=xGOUqG1rGUy-ZWo5GX+iyM9BdA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=acs@alumni.princeton.edu \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).