-P
argument to zsh's print builtin.)
The primary zsh prompt string is contained in the
shell variable PROMPT. This variable is also known as
PS1. (They are the exact same - assigning to one sets
the other.)
Before zsh actually displays them, the prompts are first subjected to
parameter expansion, command substitution, and arithmetic
expansion. (But ONLY if the PROMPT_SUBST shell option is
turned on)
As with most shells, zsh lets you display various pieces of information in your prompt. The current time, date, host information, and current directory are just simple examples.
Zsh goes much further. It allows you to truncate your prompt so that
it only takes up a certain amount of space on the command line. It
also provides many different formatting options for each piece of
information it can display. It can print the time and date with
strftime(3) functionality. Zsh supports 'conditional
expressions' within prompts. This means that zsh will display
different things in your prompt(s) based on certain conditions.
In the next few sections, we will cover all of the facilities available for you to customize your prompt(s) with.