I'm trying to setup a multiple line PS1, for zsh, but \n
doesn't was parsed by zsh,
PS1="%~\n %> "
How should I set it up?
Use $'\n'
For example,
PROMPT="firstline"$'\n'"secondline "
or
NEWLINE=$'\n'
PROMPT="firstline${NEWLINE}secondline "
I know this is an old question, but I was looking for this as well. If you load prompinit (autoload -Uz promptinit && promptinit
) you get the option for free: $prompt_newline
which is $'\n%{\r%}'
.
On a Debian system you can find the source code in /usr/share/zsh/functions/Prompts/promptinit
and/or https://github.com/zsh-users/zsh/blob/master/Functions/Prompts/promptinit