zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <phil.pennock@globnix.org>
To: zsh-users@sunsite.dk
Subject: Re: get output of a command in prompt
Date: Sun, 17 Sep 2006 19:22:42 +0200	[thread overview]
Message-ID: <20060917172242.GA7825@parhelion.globnix.org> (raw)
In-Reply-To: <20060916184913.GA18417@localhost.localdomain>

On 2006-09-16 at 20:49 +0200, arno. wrote:
> So I have something like :
>  RPS1="%2v"
>  and 
> 
> precmd() {
>     gettemp
> }

> > Some people make the mistake of using it [precmd function] to set up a 
> > prompt, but there are enough ways of getting varying information into a 
> > fixed prompt string that you shouldn't do that unless you have very odd 
> > things in your prompt.
> http://zsh.sunsite.dk/Guide/zshguide03.html#l51
> 
> But I didn't find a better way to do what I want. Did I miss something, 
> or is my goal something "very odd".

I interpret the user guide text to mean "Don't set the prompt in
precmd()", given the following text: "It's a big nuisance having to
redefine precmd to alter your prompt --- especially if you don't know
it's there, since then your prompt apparently magically returns to the
same format when you change it."


So they're saying that instead of using:
 function precmd { RPS1="$(gettemp)" }
you should instead do exactly what you are doing.

For a distributed example of using precmd, see the various
prompt_*_setup routines; in particular, prompt_zefram_setup shows
something manipulating various $psvar values for later display in the
prompt.

Regards,
-Phil


      parent reply	other threads:[~2006-09-17 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-16 18:49 arno.
2006-09-16 19:01 ` Frank Terbeck
2006-09-17 14:14   ` arno.
2006-09-17 16:58     ` Bart Schaefer
2006-09-17 17:09     ` Dan Nelson
2006-09-17 17:24       ` arno.
2006-09-17 17:22 ` Phil Pennock [this message]

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=20060917172242.GA7825@parhelion.globnix.org \
    --to=phil.pennock@globnix.org \
    --cc=zsh-users@sunsite.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).