Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: auto-quoting inside braces in arguments
On Thu, Feb 18, 2021 at 9:35 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Vincent Lefevre wrote on Thu, 18 Feb 2021 13:40 +00:00:
> > Is there a way to get auto-quoting inside braces in arguments?
>
> Proof of concept:
>
> f() {
> local l=\{ r=\}
> CURSOR=${BUFFER[(i)$l]} MARK=${BUFFER[(i)$r]}
> (( -- CURSOR ))
> zle quote-region
> }
It needs to be a bit more complicated than that, because you first
have to be sure that the braces are not already quoted and do not form
a valid comma-separated (or ".." range) brace expression. Also,
should anything special happen if there is a valid brace expression
inside the invalid brace pair? Is this single- or double-quote
equivalent, or something new?
As an aside to the latter, it might be nice if providing a
prefix-argument to quote-region caused it to use double instead of
single quotes.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author