Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh request
- X-seq: zsh-workers 2445
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Huy Le <huyle@xxxxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: zsh request
- Date: Thu, 21 Nov 1996 02:54:30 -0800
- In-reply-to: Huy Le <huyle@xxxxxxxxxxxxxxxxxxxxxxxxx> "zsh request" (Nov 21, 12:57am)
- References: <199611210857.AAA26038@xxxxxxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author