The variables such as ${user_host}
can be set to desired values inside your .zshrc
file.
For example adding the following lines in your .zshrc
:
local USER_HOST="${_prompt_colors[4]}%n@%m"
local CURRENT_DIR="${_prompt_colors[5]}%~"
PROMPT="${USER_HOST} ${CURRENT_DIR}$ "
will give you a prompt like:
ron@ron ~$
The characters that start with %
in the above codes are special 'escape' sequences that are used to specify different kinds of information. Within the PROMPT variable, any occurance of these %
sequences are replaced by the information that they represent. In the above codes:
%n
represents username and is equivalent to $USERNAME
%m
represents the hostname up to the first .
%~
represents $PWD
, but will do two types of substitutions. If a named dir X
is a prefix of the current directory, then ~X
is displayed. If the current directory is your home directory, $HOME
, just ~
is displayed.
Now, you have various options to show data/time:
%t
- Current time of day, in 12-hour, am/pm format.
%T
- Current time of day, in 24-hour format.
%*
- Current time of day in 24-hour format, with seconds.
%w
- The date in day-dd format.
%W
- The date in mm/dd/yy format.
%D
- The date in yy-mm-dd format.
So,
PROMPT="${USER_HOST} ${CURRENT_DIR}%t$ "
will give a prompt like:
ron@ron ~9:11AM$
See 'Expansion of prompt sequences' in man zshmisc
or have a look at this or this for more options that are available.