Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Convert control characters to bindkey/quoted-insert -style escape sequences
- X-seq: zsh-users 29559
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Convert control characters to bindkey/quoted-insert -style escape sequences
- Date: Thu, 25 Jan 2024 10:34:04 +0200
- Archived-at: <https://zsh.org/users/29559>
- In-reply-to: <CAN=4vMrg-cChMgcNUo1EtA4NcYU2oDVv=3=Q465FTR0gHY0F+w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAN=4vMrg-cChMgcNUo1EtA4NcYU2oDVv=3=Q465FTR0gHY0F+w@mail.gmail.com>
${(V)…} is exactly what I was looking for. Thanks!
Could the documentation of that flag be updated, though?
It nows says: “Make any special characters in the resulting words visible.”
To make it easier to find, it could mention that it “quotes” or “escapes” Those are the kind of words I searched for and which are used to describe this kind of thing elsewhere in the manual. Here’s some examples:
* ${(g)…} “Process escape sequences”
* ${(q)…}: “Quote characters that are special to the shell”
* ${(q+)…}: “This quoting is similar to that used by the output of values by the typeset family of commands.”
* ${(Q)…}: “Remove one level of quotes.”
* ${(p)…} “Recognize the same escape sequences as the print builtin”
* bindkey: “the following escape sequences are recognised”
* print -b: “Recognize all the escape sequences defined for the bindkey command.”
* quoted-insert
It could also mention what format it uses to escape the characters.
Finally, parameter flags dealing with quoting/escaping could be grouped together in one section. That would help a lot.
> On 24. Jan 2024, at 15.54, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
>
> That thing with psvar that you described in another thread is
> ${(V)name}. It'll give you ^M (rather than \r) as you seem to want.
> You are still going to get \n instead of ^J and \t instead of ^I. It's
> pretty good in practice for what it is meant to do: make a string
> presentable to humans. It's not particularly consistent with the
> choice of C-escapes vs carets though.
>
> I don't know if there is a way to encode special characters
> exclusively through caret notation. This encoding is fairly simple, so
> you could also do it manually if you need to.
>
> Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author