From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18680 invoked from network); 4 Jul 1997 13:38:59 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 4 Jul 1997 13:38:59 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id JAA08842; Fri, 4 Jul 1997 09:25:45 -0400 (EDT) Resent-Date: Fri, 4 Jul 1997 09:25:45 -0400 (EDT) Message-Id: <199707041329.PAA19348@hydra.ifh.de> To: "Ingo Wilken" , zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: two new key commands for 3.0.4 In-reply-to: ""Ingo Wilken""'s message of "Fri, 04 Jul 1997 03:23:34 MET." Date: Fri, 04 Jul 1997 15:29:52 +0200 From: Peter Stephenson Resent-Message-ID: <"UXp762.0.2A2.PdFlp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3352 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "Ingo Wilken" wrote: > copy-prev-word-skip > > insert-last-args Unless you have turned off !-history (setopt nobanghist), insert-last-args can be done by typing !*. (One day it will be possible to do this within a shell function and turn on ! for the duration of the function.) As far as copy-prev-word-skip is concerned, I think the following is preferable: it alters copy-prev-word to use its prefix argument to copy words before the last, so that putting 2 in front will have the effect you want. (Arguably, it should have done this all along.) This patch is against 3.1; the code has migrated a bit and may need a little massaging for 3.0 but won't have to change fundamentally. *** Doc/Zsh/zle.yo.cpw Mon Apr 28 06:21:52 1997 --- Doc/Zsh/zle.yo Fri Jul 4 15:01:33 1997 *************** *** 550,556 **** ) tindex(copy-prev-word) item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))( ! Duplicate the word behind the cursor. ) tindex(vi-delete) item(tt(vi-delete) (unbound) (d) (unbound))( --- 550,557 ---- ) tindex(copy-prev-word) item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))( ! Duplicate the whitespace-delimited word behind the cursor. With a ! prefix argument greater than one, copy the word so many back instead. ) tindex(vi-delete) item(tt(vi-delete) (unbound) (d) (unbound))( *** Src/Zle/zle_misc.c.cpw Sun Jun 1 07:50:37 1997 --- Src/Zle/zle_misc.c Fri Jul 4 14:55:07 1997 *************** *** 508,524 **** void copyprevword(void) { ! int len, t0; ! for (t0 = cs - 1; t0 >= 0; t0--) ! if (iword(line[t0])) ! break; ! for (; t0 >= 0; t0--) ! if (!iword(line[t0])) ! break; if (t0) t0++; ! len = cs - t0; spaceinline(len); memcpy((char *)&line[cs], (char *)&line[t0], len); cs += len; --- 508,528 ---- void copyprevword(void) { ! int len, t0 = cs - 1, start = cs, m = zmult; ! do { ! for (; t0 >= 0; t0--) ! if (iword(line[t0])) ! break; ! if (zmult > 1 && m) ! start = t0 + 1; ! for (; t0 >= 0; t0--) ! if (!iword(line[t0])) ! break; ! } while (--m > 0 && t0); if (t0) t0++; ! len = start - t0; spaceinline(len); memcpy((char *)&line[cs], (char *)&line[t0], len); cs += len; -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.