zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Oliver Kiddle <opk@u.genie.co.uk>,
	Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: New prompt themes
Date: Wed, 20 Oct 1999 00:40:13 +0000	[thread overview]
Message-ID: <991020004013.ZM6357@candle.brasslantern.com> (raw)
In-Reply-To: <380CC25A.BC019EC7@u.genie.co.uk>

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.


  reply	other threads:[~1999-10-20  6:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-19 19:11 Oliver Kiddle
1999-10-20  0:40 ` Bart Schaefer [this message]
1999-10-20  4:16 ` Alternate patch " Bart Schaefer
1999-10-21  8:54   ` Oliver Kiddle
1999-10-21 15:09     ` 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=991020004013.ZM6357@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=opk@u.genie.co.uk \
    --cc=zsh-workers@sunsite.auc.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).