From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19939 invoked from network); 16 Nov 2004 15:48:51 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Nov 2004 15:48:51 -0000 Received: (qmail 47744 invoked from network); 16 Nov 2004 15:40:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Nov 2004 15:40:18 -0000 Received: (qmail 15480 invoked by alias); 16 Nov 2004 15:38:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8221 Received: (qmail 15419 invoked from network); 16 Nov 2004 15:38:42 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 16 Nov 2004 15:38:42 -0000 Received: (qmail 45196 invoked from network); 16 Nov 2004 15:38:07 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 16 Nov 2004 15:38:05 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id iAGFbDW1020822; Tue, 16 Nov 2004 07:37:13 -0800 Date: Tue, 16 Nov 2004 07:37:13 -0800 (PST) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: Peter Stephenson cc: zsh-users@sunsite.dk Subject: Re: !!:$ In-Reply-To: <200411161422.iAGEMTuv032704@news01.csr.com> Message-ID: References: <20041116134539.GB14064@pegleg.valdosta.edu> <200411161422.iAGEMTuv032704@news01.csr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 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.