zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: refering to 2nd from last history parameter?
Date: Mon, 26 Jan 2015 14:32:12 +0000	[thread overview]
Message-ID: <20150126143212.426f510d@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20150126131723.GS26664@sym.noone.org>

On Mon, 26 Jan 2015 14:17:23 +0100
Axel Beckert <abe@deuxchevaux.org> wrote:
> On Mon, Jan 26, 2015 at 12:16:49PM +0000, Peter Stephenson wrote:
> > On Mon, 26 Jan 2015 12:05:14 +0000
> > We could special case the meaning here: given that ranges have to be in
> > order, a range starting with "$" is by definition useless.  It's a bit
> > kludgy but this is !-history so it's hard to imagine anyone looking for
> > elegance.  Does this break anything?
> 
> Depends.
> 
> I'd expect that
> 
>   mkdir foo
>   mv foo foo-1
> 
> can be abbreviated 
> 
>   mkdir foo
>   mv !$ !$-1
> 
> i.e. that anything behind "!$" except a colon (as in "!$:t" or "!$:h")
> is taken literal.

That's not how it works at the moment --- because "-" means a range,
!$-1 alread has a special meaning, as you'll see if you try it.

> > I was wondering about using a different character, but I think any
> > solution where "minus" is not encoded by "-" is too obscure to be
> > useful.
> 
> I'd still prefer the form of "!!:<1" or shorter "!<2" instead of
> anything involving further characters after "$".

That's probably doable and easy enough to remember.  History's early
enough that normal syntactic meanings aren't relevant.

> Additionally, I thought we're talking about picking a single argument
> counting from the back, not from ranges of arguments -- which then could
> be "!<2-4" or "!<4-2". (I'd allow both forms as both can make sense.)

Yes, we are, but the point is "-" already *means* range and isn't going
to stop doing that.

pws


  reply	other threads:[~2015-01-26 14:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 12:18 zzapper
2015-01-22 12:57 ` Peter Stephenson
2015-01-22 13:34   ` zzapper
2015-01-23 19:59   ` Wayne Davison
2015-01-26 12:05   ` zzapper
2015-01-26 12:16     ` Peter Stephenson
2015-01-26 13:17       ` Axel Beckert
2015-01-26 14:32         ` Peter Stephenson [this message]
2015-01-26 21:30           ` Axel Beckert
2015-01-22 13:40 ` Axel Beckert
2015-01-22 15:52   ` ZyX
2015-01-22 16:09     ` Axel Beckert
2015-01-22 17:17 ` Bart Schaefer
2015-01-22 17:51   ` zzapper

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=20150126143212.426f510d@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).