When setting PROMPT2, I can add %_ to show for if
or for then
when I'm in these constructs. Is there any way to change the space to be something else, e.g. show for/if
or for:if
or even for -> if
instead of the default?
Change the separator in Zsh %_
promptzsh
Best Answer
With the
promptsubst
option enabled, you could do:${(%)...}
enables prompt expansion on the expansion of...
.${:-text}
allows to have a${...}
expand arbitrary text. And we apply the${x//pat/reply}
substitution on it. That assumes the expansion of%_
doesn't itself include%
characters.