Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [tip] mouse support
- X-seq: zsh-users 8207
- From: Bart Schaefer <schaefer@xxxxxxxxxxx>
- To: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- Subject: Re: [tip] mouse support
- Date: Thu, 11 Nov 2004 17:02:47 -0800 (PST)
- Cc: Zsh users list <zsh-users@xxxxxxxxxx>
- In-reply-to: <20041111182225.GA4345@sc>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041111122011.GB4451@sc> <4483.1100184032@xxxxxxx> <20041111162209.GC4451@sc> <Pine.LNX.4.61.0411110943030.30994@xxxxxxxxxxxxxxxxxx> <20041111182225.GA4345@sc>
On Thu, 11 Nov 2004, Stephane Chazelas wrote:
> zero='%([BSUbsu]|{*%})'
>
> It replaces '%%some %{%{some%}%}' with '%ome %}' instead of
> '%%some '
Hmm. To fix that, you need extended globbing:
setopt extendedglob
zero='(#b)([^%]|(#s))%([BSUbsu]|{*%})'
print ${(%%)PS1//$~zero/$match[1]}
On Thu, 11 Nov 2004, Stephane Chazelas wrote:
> Well the (%%) expansion flag has another problem:
>
> var='%Sfoo%s'
> PS1='$var'
>
> In that case, you need to expand first the variables in PS1 or
> you'll miss the %S %s visual sequences.
That's easy enough:
if [[ -o promptsubst ]]
then print ${(%%)${(e)PS1}//$~zero/$match[1]}
else print ${(%%)PS1//$~zero/$match[1]}
fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author