简体   繁体   中英

RPROMPT not showing on initial prompt

I'm seeing a strange issue when trying to use RPROMPT to configure my zsh prompt. I'm not using oh-my-zsh or any other plugin manager. Here is my .zshrc file:

function zle-line-init {
  RPROMPT="foo"
  zle reset-prompt
}

zle -N zle-line-init

However, on the first prompt (when opening a new shell, or new tmux window/pane), the foo doesn't show. (I then press enter and the RPROMPT shows for the new prompt.)

Why doesn't it show on the first one?

When zsh first prints the initial prompt, RPROMPT is not set so the feature is disabled. Just set RPROMPT to anything outside the zle-line-init function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM