Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: !!:$
- X-seq: zsh-users 8221
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: !!:$
- Date: Tue, 16 Nov 2004 07:37:13 -0800 (PST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <200411161422.iAGEMTuv032704@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041116134539.GB14064@xxxxxxxxxxxxxxxxxxx> <200411161422.iAGEMTuv032704@xxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Tue, 16 Nov 2004, Peter Stephenson wrote:
> [...] $history is an associative array and you need
> to know the event number, which currently isn't available as a
> parameter: you can get it from a prompt, but not directly. This strikes
> me as a curious omission. How about adding it using the same name as
> bash?
Umm.
HISTNO (integer)
The current history number. Setting this has the same effect as
moving up or down in the history to the corresponding history line.
An attempt to set it is ignored if the line is not stored in the
history.
Admittedly this is available only in widgets, but it seems odd to have two
variables for the same thing.
> Then you can always get the full previous line as
> $history[$((HISTCMD-1))].
Unfortunately that doesn't always work. If you setopt HIST_IGNORE_DUPS,
$history[$((HISTNO-1))] may be empty.
The only thing that always works is $history[${${(Onk)history}[1]}] or
some similar convolution that gets keys that are known to be in the hash.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author