zsh-workers
 help / color / mirror / code / Atom feed
* histsubstpattern in zmv
@ 2023-06-01 18:35 Stephane Chazelas
  2023-06-02  8:40 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Stephane Chazelas @ 2023-06-01 18:35 UTC (permalink / raw)
  To: Zsh hackers list

The csh-style ${var:s/foo/bar} is often more legible and easy
to cumulate than the Korn-style equivalent ${var/foo/bar}

Compare:

${${(L)var//[[:blank:]]/_}//\/foo[^/]#}

with:

${var:l:gs/[[:blank:]]/_:gs|/foo[^/]#|}

The csh-style also has :& to repeat.

But that needs set -o histsubstpattern and in zmv, emulate -LR
zsh resets options.

Would it be possibe to enable it in zmv along with extendedglob
which is already enabled there, or if not allow the user to enable it,
or maybe even better introduced some :+s/pattern/repl/
:-s/string/repl/ or :S/pattern/replacement/ so we can use both
at the same time, like ${f:gs/***/3-stars/:gS/???/any-3-chars} ?

Thanks,
Stephane


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

end of thread, other threads:[~2023-06-08  6:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 18:35 histsubstpattern in zmv Stephane Chazelas
2023-06-02  8:40 ` Peter Stephenson
2023-06-02 10:18   ` Peter Stephenson
2023-06-02 15:09     ` Stephane Chazelas
2023-06-02 15:29       ` Stephane Chazelas
2023-06-04 18:32       ` Peter Stephenson
2023-06-08  6:57       ` Jun T

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).