From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1145 invoked from network); 21 Feb 2004 14:39:50 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 21 Feb 2004 14:39:50 -0000 Received: (qmail 20279 invoked by alias); 21 Feb 2004 14:39:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7077 Received: (qmail 20251 invoked from network); 21 Feb 2004 14:39:35 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 21 Feb 2004 14:39:35 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [138.88.27.183] by sunsite.dk (MessageWall 1.0.8) with SMTP; 21 Feb 2004 14:39:35 -0000 Received: from teapot.iano-fletcher.org (by teapot.iano-fletcher.org (8.12.11/8.12.9) with ESMTP id i1LEdYwt016101 for ; Sat, 21 Feb 2004 09:39:34 -0500 Received: by teapot.iano-fletcher.org (8.12.8) id i1LEdY0H016099; Sat, 21 Feb 2004 09:39:34 -0500 Date: Sat, 21 Feb 2004 09:39:34 -0500 From: Anthony Iano-Fletcher To: zsh-users@sunsite.dk Subject: Re: incremental history search Message-ID: <20040221143934.GB16036@teapot.iano-fletcher.org> Mail-Followup-To: zsh-users@sunsite.dk References: <1lk8q9de9jvbv.dlg@thorstenkampe.de> <1epb3ga9oumiw$.dlg@thorstenkampe.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1epb3ga9oumiw$.dlg@thorstenkampe.de> User-Agent: Mutt/1.5.6i Hello history-beginning-search-backward and history-beginning-search-forward were designed to repeatedly match whatever was to the left of the cursor with one's history. The cursor shouldn't move or else a repeated match would not be looking for the original prefix. For example, suppose you have this in your history: lspci uname -a lsmod date ls If you type 'l<\M-p>' where \M-p is bound to history-beginning-search-backward then you will get successively ls, then lsmod and then lspci. Very useful if you want to choose from any of your history that starts with an 'l'. By the way, the search prefix is not just the first word - its everything to the left of the cursor. So one can choose very long commands from a bunch of similar invocations. With zsh widgets then you can always combine this search and end-of-line. Anthony. On 21 Feb 2004 at 14:52:15, Thorsten Kampe wrote: > * Eric Mangold (2004-02-21 04:07 +0100) > > On Sat, 21 Feb 2004 02:35:14 +0100, Thorsten Kampe > > wrote: > >> * Eric Mangold (2004-02-21 02:17 +0100) > >>> On Sat, 21 Feb 2004 00:04:00 +0100, Thorsten Kampe > >>> wrote: > >>>> I have bound[1] the cursor keys to "up-line-or-search" and > >>>> down-line-or-search. Unfortunately this only completes the first word > >>>> of the search; meaning when I type > >>>> > >>>> wget http://foo.com > >>>> wget ftp://bar.com > >>>> > >>>> and then... > >>>> wget http[up cursor] > >>>> ...it completes to "wget ftp://bar.com" and not to the desired "wget > >>>> http://foo.com". It only searches matches for the first word ("wget") > >>>> of the already typed command line in history. > >>>> > >>>> Is it possible to make zsh search for matches of the whole command > >>>> line ("wget http") - and not only the first word? > >>> > >>> Yes. I use the following bindings for that. > >>> > >>> bindkey '\M-p' history-beginning-search-backward > >>> bindkey '\M-n' history-beginning-search-forward > >> > >> Aah, seems like exactly what I want. Are there any functional > >> disadvantages compared to "up-line-or-search"/"down-line-or-search" > >> (because it seems to me as "history-beginning-search-backward" is a > >> superset of "up-line-or-search")? > > > > I can't think of any disadvantages, [...] > > Hm, now the cursor stays at the beginning of the command line when I > haven't typed anything and press the up cursor - contrary to the > movement to the end of the command line with "up-line-or-search". > Probably because of the missing "up-line" functionality. > > It's a bit of a nuisance because I more often change things at the end > of a command line than at the beginning but I think the extra > functionality of "history-beginning-search-backward" makes it a gain > for me though. > > Thorsten