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

Re: zsh 3pre2: carriage return in prompt



> 
> I had been using this as my prompt:
> 
> PROMPT='[%h] [OLD: $OLDPWD] [CURRENT: %~] $(echo "\n")'
> 
> That gave me the information I wanted, and a carriage return at the  
> end of the line, so my commands always began at the left margin.
> 
> This no longer works with 3.pre2.  Has something changed that makes  
> this impossible? All I want is something that looks like this:

Yes.  Quote from man zshexpn:

COMMAND SUBSTITUTION
       A  command  enclosed  in  parentheses preceded by a dollar
       sign, like so: $(...) or quoted with grave accents:  `...`
       is  replaced  with  its standard output, with any trailing
       newlines deleted.

But really using $(echo "\n") is a quite expensive solution.  It requires a
fork().  You can just simply write

PROMPT='[%h] [OLD: $OLDPWD] [CURRENT: %~]
'

If you use csh_junkie_paren, turn it of, or put a backslash at the end of
the line.

Zoltan




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