Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "converting"
- X-seq: zsh-users 4620
- From: Will Yardley <william@xxxxxxxxxxxxxxx>
- To: Zsh-users List <zsh-users@xxxxxxxxxx>
- Subject: Re: "converting"
- Date: Wed, 23 Jan 2002 23:00:47 -0800
- In-reply-to: <1011854953.21262.33.camel@jo>
- Mail-followup-to: Zsh-users List <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: New Dream Network
- References: <1011854953.21262.33.camel@jo>
Joakim Ryden wrote:
>
> i found a neat looking prompt written for bash that i'd like to use with
> zsh. the whole thing looks like:
>
> TOPBAR="$SP$MT$CL$CR User: $CB\u$NC$CR Host: $CB\h$NC$CR Time:
> $CB\t$NC$RP"
> PS1="\n$CW[$CB\w$CW]$NC$TOPBAR"
>
> i'm not really sure at all where to start with this, the only thing i
> would really know how to do is "translate" the "\u,\h,\w" to something
> zsh understands. can someone point me to a good place for starting to
> "convert" this?
hrmm perhaps TFM? search for 'PROMPT EXPANSION' in the zshall man page.
%n $USERNAME.
%M The full machine hostname.
%m The hostname up to the first `.'. An integer may
follow the `%' to specify how many components of
the hostname are desired. With a negative integer,
trailing components of the hostname are shown.
as far as \w, zsh gives a lot of options for how to display the working
directory. i suggest reading the man page.
looking at other peoples' zshrc files can be very helpful as well.
check dotfiles.net, and do searches on google.
zsh is (IMHO) more flexible than bash as far as doing prompts.
also, you don't need to do as much fancy stuff to put stuff in the xterm
titlebar.
i have:
PS1="%B%m%b%# "
(hostname in bold, percent as a regular user, pound sign (#) as root) as
my prompt, and then:
case $TERM in
rxvt|xterm*)
precmd () {print -Pn "\e]2;%n@%m%# %~ %l %w :: %T\a"}
preexec () {print -Pn "\e]2;%n@%m%# <$1> %~ %l %w :: %T\a"}
;;
esac
(if i'm in rxvt or xterm put fancy crap in the titlebar).
w
Messages sorted by:
Reverse Date,
Date,
Thread,
Author