zsh-users
 help / color / mirror / code / Atom feed
* Why are prompt expansions of %v sequences quoted in bindkey style?
@ 2024-01-23 11:03 Marlon Richert
  2024-01-23 13:05 ` Roman Perepelitsa
  0 siblings, 1 reply; 13+ messages in thread
From: Marlon Richert @ 2024-01-23 11:03 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1645 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-25 16:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 11:03 Why are prompt expansions of %v sequences quoted in bindkey style? Marlon Richert
2024-01-23 13:05 ` Roman Perepelitsa
2024-01-23 18:43   ` Marlon Richert
2024-01-23 18:55     ` Roman Perepelitsa
2024-01-23 19:15     ` Bart Schaefer
2024-01-23 20:21       ` Mikael Magnusson
2024-01-24  5:45         ` Marlon Richert
2024-01-24  8:53           ` Mikael Magnusson
2024-01-24 13:37             ` Marlon Richert
2024-01-24 19:35               ` Mikael Magnusson
2024-01-25  8:42                 ` Marlon Richert
2024-01-25  9:20                   ` Lawrence Velázquez
2024-01-25 16:16                     ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).