zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: histsubstpattern in zmv
Date: Thu, 1 Jun 2023 19:35:56 +0100	[thread overview]
Message-ID: <20230601183556.nl3zhv2kdxgj7x4d@chazelas.org> (raw)

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


             reply	other threads:[~2023-06-01 18:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 18:35 Stephane Chazelas [this message]
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

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=20230601183556.nl3zhv2kdxgj7x4d@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=zsh-workers@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).