zsh not re-computing my shell prompt

后端 未结 2 407
情话喂你
情话喂你 2021-01-17 11:21

This might be a bit fringe, but I recently moved to zsh and am having a problem customizing my shell prompt.

Part of my .zshrc looks like this:

# kee         


        
2条回答
  •  孤城傲影
    2021-01-17 11:39

    You are half the way to solving this problem:

    PS1='$(date)'
    

    will show you prompt $(date), but

    PS1='$(date)'
    setopt promptsubst
    

    will show you prompt Thu Aug 9 21:01:53 MSK 2012 (depends on $LANG and $LC_TIME, of course).

    By the way, in the newest zsh you don’t need to use %{$fg[blue]%} anymore, there is nos %F{blue} for foreground, %K{blue} for background, %f%k for resetting them and a few others, see man zshmisc, section EXPANSION OF PROMPT SEQUENCES.

提交回复
热议问题