LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] zsh version of justin's nifty two line prompt...

[ILUG] zsh version of justin's nifty two line prompt...

kevin lyda kevin+dated+1092594261.34b129 at ie.suberic.net
Tue Aug 10 19:24:11 IST 2004


justin mason posted up this article on a nifty two line prompt:

    http://taint.org/2004/06/25/021246a.html

ever since i switched to gnome-terminal i've missed the xterm feature of
triple-click-highlights-current-word-to-the-right-margin.  so this is a
way to get it back.

the zsh version doesn't need a pre command.  it prints the exit code in
green if it's 0 otherwise it prints it in red.  i don't care what
command i'm on, but i do care what tty i'm on.  so the second line shows
that.  anyway, here it is:

    PS1=": exit=%B%(?.%{^[[32m%}.%{^[[31m%})%?%{^[[30m%}%b %S%w %(t.Ding.%T)%s ; cd %{^[[35m%}%B%~%{^[[30m%}%b
    %B%{^[[34m%}: %n@%{^[[35m%}%m%{^[[34m%} on %y ;%{^[[30m%}%b "

note that the ^[ chars are actually escape chars.  in vi you'd enter
them by typing C-v[esc].  and \n didn't work for inserting newlines so
that's why it's split on two lines.

kevin

-- 
american citizen?  register to vote: ~ florida voters - make sure you
https://register.votenet.com/LWV/    ~ haven't been struck from the
live overseas?  look here:           ~ voting lists.  check for your name
http://www.tellanamericantovote.com/ ~ here: http://tinyurl.com/2hbuj



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell