From: Marlon Richert <marlon.richert@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Why are prompt expansions of %v sequences quoted in bindkey style?
Date: Tue, 23 Jan 2024 13:03:49 +0200 [thread overview]
Message-ID: <CAHLkEDtBvSeDZUETfrTFYygyB8XRnrcqHia7tYmOmhyYQ395Tg@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2024-01-23 11:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 11:03 Marlon Richert [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHLkEDtBvSeDZUETfrTFYygyB8XRnrcqHia7tYmOmhyYQ395Tg@mail.gmail.com \
--to=marlon.richert@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).