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

Re: auto-quoting inside braces in arguments



Vincent Lefevre wrote on Thu, 18 Feb 2021 13:40 +00:00:
> Is there a way to get auto-quoting inside braces in arguments?
> For instance,
> 
>   echo {a b}
> 

Proof of concept:

f() {
  local l=\{ r=\}
  CURSOR=${BUFFER[(i)$l]} MARK=${BUFFER[(i)$r]}
  (( -- CURSOR ))
  zle quote-region
}

> would give 2 words "echo" and "{a b}" (which is different from what
> a POSIX shell would give, but the behavior is already different
> anyway, as one gets a parse error otherwise). Obviously this rule
> should be applied only for arguments.
> 
> Alternatively, one could have a feature like url-quote-magic.
> 
> -- 
> Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
> 
>




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