iTerm2 : Adapting zshrc prompt to get the same one than with .bashrc

Solution 1:

Here you go:

# %F/%f: start/end Foreground color
# %F{m}/%F{g}/%F{c}: short for %F{magenta}/%F{green}%F{cyan}
# %B/%b: start/end Bold/Bright (depending on your terminal)
# %n: user Name
# %m: Machine name
# %*: 24h time w/ seconds
# %~: pwd, abbreviated
local I='%F{m}|%f'
PS1="$I%B%F{g}%n@%F{c}%m%b$I%*$I%B%F{m}%~%b$I "

This recreates the exact same prompt.

Documentation can be found at http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html