Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to put "X" to right prompt to indicate number of jobs in Zsh

This article's code does not work for me. I have pasted all its code to my .zshrc.

I have the following in my .zshrc

RPROMPT='%{\[0;33m%}%1v%{\[0m%}'

It should indicate whether you have jobs or not. However, it does not do that for me.

I would like to get an X to the right prompt to indicate that you have a job running.

How can you have a right prompt which shows X if you have more than one jobs in Zsh?

like image 969
Léo Léopold Hertz 준영 Avatar asked Nov 25 '25 06:11

Léo Léopold Hertz 준영


1 Answers

The code you're using won't work because it's trying to use the $psvar variable, which you haven't set. Probably that article mentioned it somewhere else.

Anyway, to display the number of jobs in the RPROMPT, use

$> RPROMPT="%j Job(s)"

To have it display an 'X' if you have at least one job running, use

$> RPROMPT="%1(j.X.)"

Look under the PROMPT section of the zshmisc manpage, or take a link: http://www.manpagez.com/man/1/zshmisc/ . It explains all the expansion sequences that you can use to display information in your prompt.

like image 172
sykora Avatar answered Nov 26 '25 22:11

sykora



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!