I'm struggling to understand how to italicise a section of my zsh prompt (using prezto).
My prompt currently looks like this:
PROMPT='%F{yellow}%T %F{magenta}${SSH_TTY:+%n@%m }%F{cyan}%1~%f${vcs_info}\
55 %(!.%B%F{red}#%f%b.%B %(?.%F{green}.%F{red})❯%f%b) '
Say I wanted to make the vcs_info italic, how would I do that?
In theory, the ANSI escape code
\e[3m
sets the italic SGR. So to answer your question, this should work:Unfortunately,
italic text
is not widely supported in terminals emulators. Some just ignore it, others inverse the colors instead of italicizing text. To test your terminal emulator, check the output ofecho -e "\e[3mitalic\e[0m"
. If that doesn't printitalic
, you need to use a terminal emulator that does, such as gnome-terminal.