From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24888 invoked from network); 11 Mar 2000 23:55:46 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 11 Mar 2000 23:55:46 -0000 Received: (qmail 17259 invoked by alias); 11 Mar 2000 23:55:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10077 Received: (qmail 17247 invoked from network); 11 Mar 2000 23:55:40 -0000 Date: Sat, 11 Mar 2000 23:55:39 +0000 From: Adam Spiers To: zsh-workers@sunsite.auc.dk Subject: Re: Good documentation about literal escape sequences in prompt? Message-ID: <20000311235539.A28150@thelonious.new.ox.ac.uk> Reply-To: Adam Spiers Mail-Followup-To: zsh-workers@sunsite.auc.dk References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from juhtolv@st.jyu.fi on Sun, Mar 12, 2000 at 01:41:37AM +0200 X-Home-Page: http://www.new.ox.ac.uk/~adam/ X-OS: Linux 2.2.12 i686 Juhapekka Tolvanen (juhtolv@st.jyu.fi) wrote: > > %{...%} > Include a string as a literal escape sequence. The > string within the braces should not change the cursor > position. Brace pairs can nest. > > Hey, come on! Do you really think that is enough? Why don't you provide some > good examples? I know you can do it better! > > For example this does not work: > > PS1="%{\e[1;31m%}$PS1%{\e[1m%}" That's because \e doesn't mean anything special within double-quotes; it only gets interpreted as ASCII 27 when used inside $'' quotes, or from the `print', `echo', or `bindkey' built-ins. So what you want is: PS1=$'%{\e[1;31m%}'"$PS1"$'%{\e[1m%}' I also made this mistake when first messing around with prompts, so it looks like the relevant docs could indeed do with a bit of improvement. (Would do this myself, but still waiting for someone to give me the go-ahead on sourceforge, or at least make up-to-date snapshots available so that I can submit reliable patches. Anyone planning to release dev-20 before pws comes back?) Adam