Index · Archives · Atom

Multi-line ZSH prompts

Not that I'd be using something like this, but since the question came up in #zsh and I couldn't find any post listing the most sensible solutions, I decided to document the results.

In order to get a prompt that looks like

host – 13:33:37
user:~:%

just set your PROMPT variable to one of the following values.

Option 1: Use \n within $'' (that's two single quotes):

PROMPT=$'%m – %*\n%n:%~:%# '

Option 2: Use a line break within "":

PROMPT="%m – %*
%n:%~:%# "

Option 3: Use $prompt_newline

PROMPT="%m – %*$prompt_newline%n:%~:%# "

© drc. Built using Pelican. Theme by Giulio Fidente on github.