zsh-users
 help / color / mirror / code / Atom feed
From: Andrew Main <zefram@tao.co.uk>
To: fk5a005@rrz.uni-hamburg.de (Matthias Kopfermann)
Cc: zsh-users@math.gatech.edu
Subject: Re: can i have jobs in my prompt?
Date: Fri, 12 Sep 1997 18:50:30 +0100 (BST)	[thread overview]
Message-ID: <199709121750.SAA07577@taos.demon.co.uk> (raw)
In-Reply-To: <199709121736.TAA23418@rzaix43.rrz.uni-hamburg.de> from "Matthias Kopfermann" at Sep 12, 97 07:36:15 pm

Note: I'm CCing this reply to zsh-users, as the answer is likely to be
of general interest.


Matthias Kopfermann wrote:
>i forget how many jobs are running, especially if they are in the background.
>what would you do here?
>
>-f4-7)-%{`builtin jobs`%}-

Don't use %{%}.  They are used to indicate a sequence that doesn't move
the cursor, such as a colour escape sequence.  Also, $() is recommended
over ``, but in any case jobs doesn't work in a subshell.  A possible
approach would be to put something in precmd (a function run before each
prompt) like this:

function precmd {
  if jobs % >& /dev/null; then
    psvar=("*")
  else
    psvar=("")
  fi
}

And then put "%1v" in your prompt, for example:

PROMPT="%1v> "

and this will put a * in your prompt if there are any background jobs.
You can substitute any other sequence.

I think I might start using this myself.

-zefram


       reply	other threads:[~1997-09-12 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199709121736.TAA23418@rzaix43.rrz.uni-hamburg.de>
1997-09-12 17:50 ` Andrew Main [this message]
1997-09-14  2:39   ` Deborah Ariel Pickett

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=199709121750.SAA07577@taos.demon.co.uk \
    --to=zefram@tao.co.uk \
    --cc=fk5a005@rrz.uni-hamburg.de \
    --cc=zsh-users@math.gatech.edu \
    /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).