Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: named jobs in RPROMPT

2011/9/20 Daniel <quite@xxxxxxxx>:
> (...)
> 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

Messages sorted by: Reverse Date, Date, Thread, Author