help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Frank Schwidom <schwidom@gmx.net>
Cc: zsh-users@zsh.org
Subject: Re: Hi, can someone help me to convert my bash PS1 to zsh?
Date: Mon, 21 Mar 2022 17:57:41 +0100	[thread overview]
Message-ID: <CAHYJk3S7XHDf98D3qCeC0bwmD3KqXqr52pX1xwm8Nnr=OFr1sg@mail.gmail.com> (raw)
In-Reply-To: <20220321160650.GA1727@debian64>

On 3/21/22, Frank Schwidom <schwidom@gmx.net> wrote:
> And here it is:
> (ins)$ echo "$PS1"
> \[\]\u@\h \D{%Y-%m-%d %H:%M:%S}:\n\[\]\w\n\[\]\$\[\]
> (ins)$ set | grep '^PS1='
> PS1=$'\\[\E[32m\\]\\u@\\h \\D{%Y-%m-%d
> %H:%M:%S}:\\n\\[\E[33m\\]\\w\\n\\[\E[35m\\]\\$\\[\E[0m\\] '

The manpage lists all the codes for zsh, which start with %. If you
don't want to scroll down that much, you can also interactively type
PS1=% and then hit tab for an abbreviated list. (the format inside
%D{} is likely to be the exact same)

Separately from that, you'll want to remove any \e[32m stuff and
instead use %F{red} to start a color and %f to end (eg the 0m). If you
use hardcoded escape sequences, you have to write %{ %} around them,
or your cursor will end up in funny places, but there is no reason to
do so for the codes you use.

For example you might have, PS1='%F{blue}%n@%m %D{%Y-%m}%f' etc. (I
don't know what the remaining bash codes correspond to).

Mikael Magnusson

  reply	other threads:[~2022-03-21 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 16:06 Frank Schwidom
2022-03-21 16:57 ` Mikael Magnusson [this message]
2022-03-21 17:47   ` Frank Schwidom
2022-03-21 17:59     ` Mikael Magnusson
2022-03-21 18:51       ` Roman Perepelitsa
2022-03-21 21:43         ` Bart Schaefer
2022-03-22  0:36           ` Frank Schwidom
2022-03-21 18:11     ` Bart Schaefer
2022-03-21 18:17       ` Frank Schwidom
2022-03-21 18:56     ` Lawrence Velázquez

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:

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

  git send-email \
    --in-reply-to='CAHYJk3S7XHDf98D3qCeC0bwmD3KqXqr52pX1xwm8Nnr=OFr1sg@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=schwidom@gmx.net \
    --cc=zsh-users@zsh.org \
    --subject='Re: Hi, can someone help me to convert my bash PS1 to zsh?' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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


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