Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: two new key commands for 3.0.4
- X-seq: zsh-workers 3352
- From: Peter Stephenson <pws@xxxxxx>
- To: "Ingo Wilken" <Ingo.Wilken@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: two new key commands for 3.0.4
- Date: Fri, 04 Jul 1997 15:29:52 +0200
- In-reply-to: ""Ingo Wilken""'s message of "Fri, 04 Jul 1997 03:23:34 MET." <m0wjx5z-000AgCC@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
"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 !*<TAB>. (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 <ESC>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 <pws@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author