zsh-users
 help / color / mirror / code / Atom feed
From: Vin Shelton <acs@alumni.princeton.edu>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: Date format in prompt
Date: Tue, 24 Nov 2020 07:50:23 -0500	[thread overview]
Message-ID: <CACeGjnUjDV6iYETzD-Le48G1-L-aW+8uCHJBM3+ECKJy5Fcqug@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7a6BMat+jGwAfmxowV=xGOUqG1rGUy-ZWo5GX+iyM9BdA@mail.gmail.com>

[-- 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 --]

  reply	other threads:[~2020-11-24 12:53 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
2020-11-24 12:50   ` Vin Shelton [this message]
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=CACeGjnUjDV6iYETzD-Le48G1-L-aW+8uCHJBM3+ECKJy5Fcqug@mail.gmail.com \
    --to=acs@alumni.princeton.edu \
    --cc=schaefer@brasslantern.com \
    --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).