Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

  (email not shown publicly)
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Tuesday March 28, 2006
12:03 AM

a new zsh prompt

[ #29123 ]

I was looking into some zsh functionality today and decided it was time to update my prompt. Here's what I've come up with so far, with the help of jcap:

export PS1="%~$(print '%{\e[1m%}%(!.%{\e[31m%}#.%{\e[32m%}$)%{\e[0m%}') " export RPS1="%m@%D{%H%m%S}:%h"

This replaces my old prompt of:

export PS1='%m!%n:%~%(!.#.$) '

I liked the UUCP-style identifier, but the super-reduced left hand side is pretty slick, as is the one dot of color. (I tried using the built-in colors function, but it gave me grief.) I'd like to tidy up the RPS1, but I'm not sure how, yet.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I use the builtin prompts that come with zsh. In particular, this setup works well for me:
    autoload -U promptinit ; promptinit
    prompt bart
    • Oh, no, adam1 for me all the way. :) If you need the time and date, just drop this into your .screenrc: (You use screen, right?)
      hardstatus alwayslastline "%-w%{.wB}%n %t%{-}%+w %=%{.w} %H: %l %{-}%d/%m %c"
      • I never leave home without screen. But that's very neat -- I like it!


      • I want the timestamp on my prompt so that I can see, when I look back, when I executed each command. That's one of the better status lines I've seen for screen; maybe I'll use it... but as for all the promptinit, most of them are too much. Too much color, too much text, too much 1337. Some of them are alright, but I think I'll stick with my new one.

        (How can people use three-line prompts? Yow!)
      • Don’t use hardstatus, use caption.

        hardstatus can be affected using escape sequences from within a screen window (so you don’t want it as the bottom line), but it can passed through to the title of an xterm if you set your .screenrc up correctly (so you want something else to set up the bottom line).

        Try this:

        caption always '%-w%{.wB}%n %t%{-}%+w %=%{.w} %H: %l %{-}%d/%m %c'
        termcapinfo xterm*|rxvt* 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' # pass hardstatus thru to xterm

  • I just include the $WINDOW from screen in my prompt, and make sure that I always use a given screen window for the same task. Information density!
    • Just before lunch I was wondering whether I could use some sort of escape string to cause my .login to change the screen window's name to the hostname. That way, the sequence "C-a c ssh foo" would result in a new window that would quickly get the name "foo." I haven't consulted the manual yet, but will do today.