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

Re: "converting"



On Wed, 2002-01-23 at 23:00, Will Yardley wrote:
> 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.

right, i just said these were about the only things i knew how to
"translate" from the prompt above.

ok, let's try the question again... the problem with the above prompt
(assuming you change the \w etc to %~ or whatever) is this:

.zshrc:13: bad math expression: operand expected at `\[\033[0;1...'

i'm not sure whether this is because i have a certain combination of
setopt's or am lacking some setopt's[1] or the control codes need to be
expressed differently etc.

also, the prompt is neat but i'm not about to read TWFM to figure out
what i need to do to get it to work in zsh. :)

<SNIP>

> also, you don't need to do as much fancy stuff to put stuff in the xterm
> titlebar.

the above prompt doesn't put anything in the xterm titlebar. it keeps a
"floating" bar with username/host/time in the terminal window. fire up
bash and try it. ;)

--Jo

[1] these are the options i have set:

autocd
noautoparamslash
autopushd
autoresume
nobgnice
cdablevars
noclobber
correct
correctall
globdots
histignoredups
nohup
interactive
interactivecomments
login
longlistjobs
mailwarning
markdirs
monitor
printexitvalue
promptsubst
pushdminus
pushdsilent
pushdtohome
rcquotes
recexact
shinstdin
zle

Attachment: signature.asc
Description: This is a digitally signed message part



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