From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: irrlicht2c@gmx.net
Cc: zsh-users@sunsite.dk
Subject: Re: Colored PS1
Date: Wed, 07 Sep 2005 19:21:06 +0200 (CEST) [thread overview]
Message-ID: <20050907.192106.74752061.Meino.Cramer@gmx.de> (raw)
In-Reply-To: <qri2v2-n14.ln1@news.irrlicht.homelinux.net>
From: Tim Kruse <irrlicht2c@gmx.net>
Subject: Re: Colored PS1
Date: Wed, 7 Sep 2005 09:53:01 +0200
> * On 07.09.2005 Meino Christian Cramer wrote:
>
> > export PS1="%B%(?..[%?] )$fg_bold[red]%b$fg_no_bold[black]%n@%U%m%u:%1~>"
> >
> > but this does not work for me. The prompt remains the same but
> > expansion/expanding on the commandline gets a hickup. My TERM is set
> > to "xterm" and normally colored output is no problem.
>
> You should enclose your color definitions between '%{' and '%}'
>
> From the manual page:
>
> ,-----[man zshall]
> | PROMPT EXPANSION
> | [...]
> | Visual effects
> | [...]
> | %{...%}
> | Include a string as a literal escape sequence. The string within
> | the braces should not change the cursor position. Brace pairs can
> | nest.
> `-----
>
> Try something like this
>
> % ps_beg="%B%{$fg_bold[red]%}%(?..[%?] )%b%{$fg_no_bold[black]%}%n@%U%m%u:"
> % ps_end="%1~>%{$fg_bold[default]$fg_no_bold[default]%}"
> % export PS1="${ps_beg}${ps_end}"
>
> I don't know if "%fg_bold[default]$fg_no_bold[default]" is
> really necessary here ...
>
> Btw, %b you mentioned is the end of bold output. See also the
> manual page (man zshmisc search for PROMPT EXPANSION)
>
> So long,
> tkr
>
> --
> *** Topic for #redhat: ReDHaT is the answer to all your problems. It
> could be the start too!
Hi Tim, hi Bart !
Thank you very much for your prompt reply :)
Let's have a look, whether I understood things right:
First of all my all simple PS1:
export PS1=%M:%2d
This should be the base.
Now: I want my machine being displayed in bold black (technical
gadget have to be in black, isn't it? ;)
Now I would write:
export PS1=$fb_bold[black]%M$fb_no_bold[black]:%2d
But this would not work (that's why I wrote my mail...). As I
understand your mail, I had to enclose the "literally escape
sequence" (whatever this is...I am no native English speaker and if
translated to german this makes really no sense - as with so many
technospeak expressions...
And how should I figure out, whether the cursor position would
have been changed...???
So I would guess this cames more closer to what is right:
export PS1=%{$fg_bold[black]%}%M%{$fg_no_bold[black]%}:%2d
but this one produces
}solfire:/home/mccramer
brace levels and nesting seems right for me and my editor--but there
is one '}' left behind. No colors, no bold. "autoload -U colors &&
colors" was executed before.
Enclosing the whole thing in ${...} gives me no prompt at all.
And what is the reason for the ps_beg/ps_end trick? Why no to write
everyting in one big term ?
Oh, damn, I fear I am too stupid... ;O)
Have a colorfull evening!
Meino (slightly %{confused%})
next prev parent reply other threads:[~2005-09-07 17:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-07 3:25 Meino Christian Cramer
2005-09-07 7:53 ` Tim Kruse
2005-09-07 14:57 ` Bart Schaefer
2005-09-07 17:21 ` Meino Christian Cramer [this message]
2005-09-08 2:39 ` Bart Schaefer
2005-09-08 3:31 ` Meino Christian Cramer
2005-09-08 16:05 ` Bart Schaefer
2005-09-08 16:59 ` Meino Christian Cramer
2005-09-09 14:32 ` 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=20050907.192106.74752061.Meino.Cramer@gmx.de \
--to=meino.cramer@gmx.de \
--cc=irrlicht2c@gmx.net \
--cc=zsh-users@sunsite.dk \
/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).