From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Huy Le <huyle@gluttony.ugcs.caltech.edu>, zsh-workers@math.gatech.edu
Subject: Re: zsh request
Date: Thu, 21 Nov 1996 02:54:30 -0800 [thread overview]
Message-ID: <961121025430.ZM1071@candle.brasslantern.com> (raw)
In-Reply-To: Huy Le <huyle@gluttony.ugcs.caltech.edu> "zsh request" (Nov 21, 12:57am)
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
next prev parent reply other threads:[~1996-11-21 11:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-21 8:57 Huy Le
1996-11-21 10:54 ` Bart Schaefer [this message]
1996-11-22 16:09 ` insert-last-word (was Re: zsh request) JD Laub
1996-11-22 18:09 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=961121025430.ZM1071@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=huyle@gluttony.ugcs.caltech.edu \
--cc=schaefer@nbn.com \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).