From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id WAA08779 for ; Thu, 21 Nov 1996 22:08:10 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id FAA19847; Thu, 21 Nov 1996 05:50:34 -0500 (EST) Resent-Date: Thu, 21 Nov 1996 05:50:34 -0500 (EST) From: "Bart Schaefer" Message-Id: <961121025430.ZM1071@candle.brasslantern.com> Date: Thu, 21 Nov 1996 02:54:30 -0800 In-Reply-To: Huy Le "zsh request" (Nov 21, 12:57am) References: <199611210857.AAA26038@envy.ugcs.caltech.edu> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.820 20aug96) To: Huy Le , zsh-workers@math.gatech.edu Subject: Re: zsh request MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"QxW3F.0.1s4.vF3bo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2445 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 21, 12:57am, Huy Le wrote: } Subject: zsh request } } I have a couple of keybinding requests: } } 1) insert-second-to-last-word (in the same spirit as insert-last word, } which I use constantly) I think making insert-last-word read its prefix argument as a word position would be preferable. In the current code, insert-last-word ignores the prefix, so this is a reasonably compatible change. Drawback: Word 0 is the command name, but ESC 1 ESC _ must count from the right to be compatible with the past implementation (zsh is not able to distinguish the 1 prefix from no prefix at all). This means all positive numbers should count from the right; which is OK because the name is after all insert-last-word, so ESC 2 ESC _ means insert the second word back from the end. (Then you use bindkey -s to put this on a single keystroke; presto, insert-second-last-word.) So of course negative prefixes count from the left, with the slight oddity that ESC 0 ESC _ also counts from the left (giving you the command name). *** Src/zle_hist.c.0 Sun Jul 28 13:48:29 1996 --- Src/zle_hist.c Thu Nov 21 02:25:07 1996 *************** *** 483,490 **** feep(); return; } ! s = he->text + he->words[2*he->nwords-2]; ! t = he->text + he->words[2*he->nwords-1]; save = *t; *t = '\0'; /* ignore trailing whitespace */ --- 483,499 ---- feep(); return; } ! if (zmult > 0) { ! zmult = he->nwords - (zmult - 1); ! } else { ! zmult = 1 - zmult; ! } ! if (zmult < 1 || zmult > he->nwords) { ! feep(); ! return; ! } ! s = he->text + he->words[2*zmult-2]; ! t = he->text + he->words[2*zmult-1]; save = *t; *t = '\0'; /* ignore trailing whitespace */ -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern