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

Re: If then Prompt

On 24/05/07, fREW <frioux@xxxxxxxxx> wrote:
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.
if [[ $TERM == linux ]]; then
    precmd () { print -Pn "\e]0;%m: %~\a" }

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.

if [[ $TERM == screen]; then
   function precmd() {
     print -Pn "\033]0;S $TTY:t{%100<...<%~%<<}\007"
elsif etc

personally i use a case $TERM in ... screen) ... *) ... construct
Mikael Magnusson

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