From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10534 invoked from network); 27 Nov 1997 18:30:28 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 27 Nov 1997 18:30:28 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA08020; Thu, 27 Nov 1997 12:56:56 -0500 (EST) Resent-Date: Thu, 27 Nov 1997 12:56:39 -0500 (EST) From: "Bart Schaefer" Message-Id: <971127095558.ZM2955@candle.brasslantern.com> Date: Thu, 27 Nov 1997 09:55:58 -0800 In-Reply-To: <97Nov26.191202gmt+0100.17029@internet01.amc.de> Comments: In reply to Christopher Croughton "History key bindings" (Nov 26, 6:10pm) References: <97Nov26.191202gmt+0100.17029@internet01.amc.de> X-Mailer: Z-Mail (4.0b.820 20aug96) To: Christopher Croughton , zsh-users@math.gatech.edu Subject: Re: History key bindings MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"_6gdI1.0.vy1.MHRVq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1153 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 26, 6:10pm, Christopher Croughton wrote: } Subject: History key bindings } } Is there some way to cause zsh to remember the buffer up to where it was } when the search started and use that, while putting the cursor at the end } still? That shouldn't be terribly difficult to code as a zle module, if you have 3.1.2. The code for vi-repeat-search might be a good starting point. However, this does a pretty good job: bindkey '^X^P' history-beginning-search-backward bindkey -s '^[[A' '^X^X^X^P^@^E' That binds up-arrow to: exchange-point-and-mark ^X^X history-beginning-search-backward ^X^P set-mark-command ^@ end-of-line ^E When you first press up-arrow, there (normally) won't be any mark on the line, so ^X^X does nothing. Then ^X^P finds the previous history item with the prefix, ^@ sets the mark at the end of the prefix, and ^E moves the cursor to end of line. Next time you press up-arrow, ^X^X puts the cursor back at the prefix again, so ^X^P finds the further previous history with the same prefix. Then the mark is set and the cursor moved to end of line again. } From the documentation it seems that up until version 3 something } like this was normal, and then the history-search-backward etc. was } changed to only match on the first word. Yeah, I was never satisfied with the explanations for why that changed. The new behavior doesn't seem as useful to me. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com