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

Re: get the number of active jobs to show in the prompt?



On 2001-10-01 at 18:28 +1000, Deborah Ariel Pickett wrote:
> Looks like you've already got an answer, but there are better ways to do
> this from zsh 3.1.9 onwards.

Ooh, thanks!  Wonder how I missed this when reading zshmodules(1)?
*sighs*

> Insert "zmodload zsh/parameter" in a suitable zsh startup file (such as
> .zshrc) before trying this.

Yep, works beautifully; I now use:
zmodload zsh/parameter
function precmd { [... all the other bits ...]
	psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
}
and then in PS1: %(2v:<+%2v>:-)

Let more linenoise^Wzsh beauty.
-- 
Whoever despises the high wisdom of mathematics nourishes himself on delusion
and will never still the sophistic sciences whose only product is an eternal
uproar -- Leonardo da Vinci

Attachment: pgp339GofBi87.pgp
Description: PGP signature



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