Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: History expansion surprisingly sets event designator
- X-seq: zsh-workers 41237
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Leah Neukirchen <leah@xxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: History expansion surprisingly sets event designator
- Date: Tue, 06 Jun 2017 17:43:45 +0100
- Cms-type: 201P
- In-reply-to: <87d1ahcdzo.fsf@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CGME20170606161125epcas2p251421009eed052386daeae65f8bfd810@epcas2p2.samsung.com> <87d1ahcdzo.fsf@gmail.com>
On Tue, 6 Jun 2017 17:50:03 +0200
Leah Neukirchen <leah@xxxxxxxx> wrote:
> Hi,
>
> on #zsh we discovered:
>
> zsh 5.3.1 (x86_64-unknown-linux-gnu)
> zsh-5.3.1-0-g06b1b7a (and zsh-5.3.1-204-g62c4169, via danielsh)
> % zsh -f
> juno% printf a b c
> a%
> juno% echo x y z
> x y z
> juno% echo !printf:2<TAB><DEL>!:3<RET>
> c
>
> The first tab expansion will correctly expand to "b", but it changes
> the event designator to the printf-line, resulting in !:3 expanding to "c",
> while the typed in line "echo !:3" itself would refer to the previous
> line, the echo-line, and should result in "z".
> (Same for tab-expanding the second history reference.)
>
> Pressing ^U will not reset this, but pressing ^C will.
Yes, that's how it works. I haven't understood why you think it's a
problem but I presume you're used to some other shell.
If you want to turn this feature off, use CSH_JUNKIE_HISTORY; see the
HISTORY EXPANSION section in the zshexpn manual. Or use two !!s to
refer to the immediately preceding event.
By default, a history reference with no event designator refers to the
same event as any preceding history reference on that command line; if
it is the only history reference in a command, it refers to the previ‐
ous command. However, if the option CSH_JUNKIE_HISTORY is set, then
every history reference with no event specification always refers to
the previous command.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author