Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: If then Prompt
- X-seq: zsh-users 11506
- From: fREW <frioux@xxxxxxxxx>
- To: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- Subject: Re: If then Prompt
- Date: Thu, 24 May 2007 10:29:20 -0600
- Cc: "Zsh users list" <zsh-users@xxxxxxxxxx>
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Btu/16O9j8OHqVzFi4d2w8nB+79ZahN7C1KN+yFu2H8V2E7wTdnM4H7eLqNNwQ2zMJd8dEAaGFAnBYzUg5gTEuE4HuS5BLFDQINkwhgig8bHhF9Y3uzp/EYa5l2RwAv3CqiR3BuIAS8PaSyDewmrOqa3Kh4GeHZafyPi0ZSCnzQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=f/E+lvDt9CLTh/k/+5foeTC8oHCDrDyALTtSBBnxyZJ3NCZBwERPOlPnS8o7JvKrXR4IYvar3OS6sLUjyR2Z/2nzyylsor8JAdF0LaatMTei7z1aeYlp08Ma1zKCmHyyqB+D21tfyAI5pZ3S6Md3J/FL0vdZCfJAHmAV8RjoZf4=
- In-reply-to: <237967ef0705240918w6a923e7fk9e7f28164037715e@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <fb3648c60705240913pedbd3afx957b60b804b33d1a@xxxxxxxxxxxxxx> <237967ef0705240918w6a923e7fk9e7f28164037715e@xxxxxxxxxxxxxx>
On 5/24/07, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
On 24/05/07, fREW <frioux@xxxxxxxxx> wrote:
> Hey all,
>
> I was thinking that it would be cool to show the number of jobs if
> there were more than 0 jobs. I know you can do this with things like
> the return value, is there any way to do it with jobs?
Sure,
PS1=$'%(1j.%j jobs .)'
--
Mikael Magnusson
Awesome! Thanks! If anyone cares or wants to see it, here is my
current prompt.
host_color=cyan
history_color=yellow
user_color=green
root_color=red
directory_color=magenta
error_color=red
jobs_color=green
host_prompt="%{$fg_bold[$host_color]%}%m%{$reset_color%}"
jobs_prompt1="%{$fg_bold[$jobs_color]%}(%{$reset_color%}"
jobs_prompt2="%{$fg[$jobs_color]%}%j%{$reset_color%}"
jobs_prompt3="%{$fg_bold[$jobs_color]%})%{$reset_color%}"
jobs_total="%(1j.${jobs_prompt1}${jobs_prompt2}${jobs_prompt3} .)"
history_prompt1="%{$fg_bold[$history_color]%}[%{$reset_color%}"
history_prompt2="%{$fg[$history_color]%}%h%{$reset_color%}"
history_prompt3="%{$fg_bold[$history_color]%}]%{$reset_color%}"
history_total="${history_prompt1}${history_prompt2}${history_prompt3}"
error_prompt1="%{$fg_bold[$error_color]%}<%{$reset_color%}"
error_prompt2="%{$fg[$error_color]%}%?%{$reset_color%}"
error_prompt3="%{$fg_bold[$error_color]%}>%{$reset_color%}"
error_total="%(?..${error_prompt1}${error_prompt2}${error_prompt3} )"
if [[ $TERM == xterm ]]; then
directory_prompt=""
else
directory_prompt="%{$fg[$directory_color]%}%~%{$reset_color%} "
fi
if [[ $USER == root ]]; then
post_prompt="%{$fg_bold[$root_color]%}%#%{$reset_color%}"
else
post_prompt="%{$fg_bold[$user_color]%}%#%{$reset_color%}"
fi
PS1="${host_prompt} ${jobs_total}${history_total}
${directory_prompt}${error_total}${post_prompt} "
if [[ $TERM == linux ]]; then
else
precmd () { print -Pn "\e]0;%m: %~\a" }
fi
It doesn't show the username, because it usually doesn't matter to me
what user I am logged into (it's just a user or root) so I don't show
that. Also the last part which will put the current directory in the
title of an xterm doesn't work if you are in a screen session.
-fREW
Messages sorted by:
Reverse Date,
Date,
Thread,
Author