From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24061 invoked from network); 7 Sep 2005 17:19:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Sep 2005 17:19:23 -0000 Received: (qmail 73469 invoked from network); 7 Sep 2005 17:19:17 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Sep 2005 17:19:17 -0000 Received: (qmail 5598 invoked by alias); 7 Sep 2005 17:19:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9399 Received: (qmail 5588 invoked from network); 7 Sep 2005 17:19:09 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Sep 2005 17:19:09 -0000 Received: (qmail 72533 invoked from network); 7 Sep 2005 17:19:09 -0000 Received: from p54851d59.dip0.t-ipconnect.de (HELO solfire) (84.133.29.89) by a.mx.sunsite.dk with SMTP; 7 Sep 2005 17:18:59 -0000 Received: from localhost ([127.0.0.1]) by solfire with esmtp (Exim 4.42) id 1ED3be-0000uu-Aq; Wed, 07 Sep 2005 19:21:09 +0200 Date: Wed, 07 Sep 2005 19:21:06 +0200 (CEST) Message-Id: <20050907.192106.74752061.Meino.Cramer@gmx.de> To: irrlicht2c@gmx.net Cc: zsh-users@sunsite.dk From: Meino Christian Cramer In-Reply-To: References: <20050907.052542.74749449.Meino.Cramer@gmx.de> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Rcpt-To: irrlicht2c@gmx.net, zsh-users@sunsite.dk X-SA-Exim-Mail-From: Meino.Cramer@gmx.de Subject: Re: Colored PS1 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.1+cvs (built Sat, 28 Aug 2004 13:10:40 +0200) X-SA-Exim-Scanned: Yes (on solfire) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 From: Tim Kruse 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%})