Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Why are prompt expansions of %v sequences quoted in bindkey style?



When I declare my prompt as:

PS1=$'%{\e[2m%}%#%{\e[0m%} '

this works as I expect it to: My prompt becomes a dim/faint % followed by a space.

However, this does not work as I expect it to when I store the ANSI sequences in $psvar.

The following code:

psvar=( $'%{\e[2m%}' $'%{\e[0m%}' )
PS1='%1v%#%2v '

results in the following prompt with terminal default color:

%{^[[2m%}%%{^[[0m%}

As you can see, the strings stored in $psvar are expanded in a quoted form, à la bindkey. 

Is this intentional? If so, why? Is there a way to circumvent this?

I would like strings in $psvar to be inserted literally when using %v prompt sequences.



Messages sorted by: Reverse Date, Date, Thread, Author