zsh-users
 help / color / mirror / code / Atom feed
From: Julien Jehannet <julien@smaf.org>
To: Daniel <quite@hack.org>
Cc: zsh-users@zsh.org
Subject: Re: named jobs in RPROMPT
Date: Tue, 20 Sep 2011 21:04:49 +0200	[thread overview]
Message-ID: <CADweS+bVNb40xkP=Vu5VYMU=jtdnDSKVvjA-vGWt_6d6CKErvg@mail.gmail.com> (raw)
In-Reply-To: <loom.20110920T091456-635@post.gmane.org>

2011/9/20 Daniel <quite@hack.org>:
> (...)
> But thanks anyway, because now I tried to minimize my code even more.
>
>  setopt promptsubst
> Now consider:
>  RPROMPT='"$jobstates"'
> and
>  my_jobs() { print $jobstates }
>  RPROMPT='"$(my_jobs)"'
>
> The first one display the jobstates array, the second doesn't. Also, running
> my_jobs from the prompt does display the array. Could this be because inside
> the function, there are no background jobs? It's in a different context, or
> something like that?
>
> My idea is to have my_jobs print a very compact list of jobs, fitting in
> the right prompt.

I would reset RPROMPT periodically instead.
Maybe something similar to :

  % my_jobs() { RPROMPT=$jobstates }
  % precmd_functions=(my_jobs)

But this is just for testing because you will certainly clutter your
rprompt this way.
Don't forget that if the line is too long, the content will not be displayed.

-- 
J u l i e n    J e h a n n e t


  reply	other threads:[~2011-09-20 19:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 23:42 fhml
2011-09-20  7:27 ` Daniel
2011-09-20 19:04   ` Julien Jehannet [this message]
2011-09-25 17:39   ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2011-09-18 14:48 Daniel

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='CADweS+bVNb40xkP=Vu5VYMU=jtdnDSKVvjA-vGWt_6d6CKErvg@mail.gmail.com' \
    --to=julien@smaf.org \
    --cc=quite@hack.org \
    --cc=zsh-users@zsh.org \
    /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).