From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20151 invoked from network); 20 Oct 1999 06:49:50 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Oct 1999 06:49:50 -0000 Received: (qmail 5134 invoked by alias); 20 Oct 1999 06:48:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8338 Received: (qmail 5086 invoked from network); 20 Oct 1999 06:48:18 -0000 From: "Bart Schaefer" Message-Id: <991020004013.ZM6357@candle.brasslantern.com> Date: Wed, 20 Oct 1999 00:40:13 +0000 In-Reply-To: <380CC25A.BC019EC7@u.genie.co.uk> Comments: In reply to Oliver Kiddle "PATCH: New prompt themes" (Oct 19, 8:11pm) References: <380CC25A.BC019EC7@u.genie.co.uk> X-Mailer: Z-Mail Lite (5.0.0 30July97) To: Oliver Kiddle , Zsh workers Subject: Re: PATCH: New prompt themes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 19, 8:11pm, Oliver Kiddle wrote: > Subject: PATCH: New prompt themes > > I came across one problem when writing my own prompt setup scripts. > Basically, the prompt_subst option is disabled in my setup but was > required by a prompt which I wanted to create. I know I could just > change my own setup but I think that the system should be independant > of people's options. The trouble is that the prompt function uses > emulate -L so I can't set options in my prompt setup function. That's why the prompt themes created by bash2zshprompt install a precmd function that includes "setop promptsubst", and why I patched several of the themes Adam supplied (before that version of bash2zshprompt existed) to have such a precmd. (Article 8271.) > The following patch is a possible solution. It uses an associative > array to return the prompt options to a wrapper function which sets > them. For example, you can do: > prompt_opts=( subst set percent set bang unset ) I posted code to do a similar thing some while back ... article 6185. > The sickly colours of some of the example prompts also made me wonder > whether we should maybe separate the colour control from the prompt > content. Adam has said he intends to do this eventually. > Incidentally, I also think that Misc/colors should use associative > arrays - it would be useful to be able to do $fg[$color]. I mentioned this privately to Adam last week and he agreed it would be a good idea. > I was wondering if anyone knows a better way to match the hostnames to > the array. I have an array ($normal_hosts) listing hosts for which I > don't want to include the hostname in the prompt. It'd be nice if this > array could be treated as a list of patterns to be matched instead of > fixed strings. Instead of > + for a in $normal_hosts; do > + [[ $HOST == $a ]] && host="" > + done Just do [[ $HOST == (${(j(|))~normal_hosts}) ]] && host="" The same will work for $normal_users.