zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Recursive globbing shorthand (a la **.c)
Date: Thu, 29 Oct 2015 11:15:50 +0100	[thread overview]
Message-ID: <20151029101550.GB5820@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAHYJk3TjmMEYZ-j5VT=D4WDPtZZkFVzKNXzYw9vxZReC0o-FZg@mail.gmail.com>

On Wed, Oct 28, 2015 at 02:27:38PM +0100, Mikael Magnusson wrote:
> If this is something you do often, you can do
> alias -g '**.c=**/*.c'

It *is* something I do a lot, but with varying patterns.  A kind
of "regexp" alias woud allow that:

  alias -R REGEXP=REPLACEMENT   # usual regexp syntax plus back references
  alias -g -R [.][.][.]='../..'
  alias -g -R [*][*]\([^*/]\)='**/*\1'

(or give up the pretense that "search and replace" can be
expressed as "x=y" patterns:

  alias -g -R 's:[.][.][.]:../..:g'       # replace all (g flag)
  alias -g -R 's:[*][*]([^*/]):**/*\1:'   # replace one (no flags)
)

I frequently miss such a feature that allows some user defined
preprocessing of command lines.

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany


  parent reply	other threads:[~2015-10-29 10:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  6:57 Dominik Vogt
2015-10-28 13:27 ` Mikael Magnusson
2015-10-28 19:04   ` ZyX
     [not found]   ` <240121446059044__35603.2418822453$1446059490$gmane$org@web30h.yandex.ru>
2015-10-28 21:15     ` Stephane Chazelas
2015-10-29 10:15   ` Dominik Vogt [this message]
2015-10-29 10:53 ` Peter Stephenson

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=20151029101550.GB5820@linux.vnet.ibm.com \
    --to=vogt@linux.vnet.ibm.com \
    --cc=zsh-users@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).