How can I change the color of my prompt in zsh (different from normal text)?

前端 未结 10 1881
醉梦人生
醉梦人生 2020-12-07 07:34

To recognize better the start and the end of output on a commandline, I want to change the color of my prompt, so that it is visibly different from the programs output. As I

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 08:13

    I don't think the autoload -U colors && colors is needed anymore and one can simply do:

    PS1="%{%F{red}%}%n%{%f%}@%{%F{blue}%}%m %{%F{yellow}%}%~ %{$%f%}%% "
    

    to achieve the same result as FireDude's answer. See the ZSH documentation for more info.

提交回复
热议问题