zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Peter Stephenson <pws@csr.com>,
	Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: Re: insert-last-word/copy-prev-word/... question
Date: Tue, 12 Mar 2002 17:06:16 +0000	[thread overview]
Message-ID: <20020312170616.GA20479@logica.com> (raw)
In-Reply-To: <1020306182111.ZM23061@candle.brasslantern.com>

On Wed, Mar 06, 2002 at 06:21:11PM +0000, Bart Schaefer wrote:
> On Mar 5,  2:48pm, Peter Stephenson wrote:
> }
> } +     * If we have two arguments, the second is the position of
> } +     * the word to extract, 1..N.  The default is to use the
> } +     * numeric argument, or the last word if that is not set.
> 
> Doesn't this conflict with what the numeric argument used to mean?
> 
> I think this whole thing could have been written as a shell widget
> without resorting to modifying insert-last-word.  I just haven't had
> a lot of time to think about it yet.

Sorry for being very slow here. I was busy and only skim read the
thread before.

If we just want a shell widget, I've been using this for years:

copy-last-word() {
  setopt localoptions noksharrays
  local words
  words=( "${=LBUFFER}" )
  if [[ $LASTWIDGET = copy-last-word ]] && (( clwcount > -$#words )); then
    (( clwcount-- ))
  else
    (( clwcount=-2 ))
  fi
  LBUFFER="${LBUFFER%$words[-1]}$words[clwcount]"
}

It doesn't duplicate the current word at the first invocation like
copy-prev-word does - I find that useless. I suspect that Peter's
patch does a better job of using WORDCHARS or whatever. This just
worked for me. I'm sure it could be better.

What I've been meaning to do in ages is combine this with 
insert-last-word so you can use insert-last-word to go up a few
lines and then go back along the words of that previous line.

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


      reply	other threads:[~2002-03-12 17:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020301153313.A8129@lifebits.de>
2002-03-05 14:48 ` Peter Stephenson
2002-03-05 16:22   ` Peter Stephenson
2002-03-06 18:21   ` Bart Schaefer
2002-03-12 17:06     ` Oliver Kiddle [this message]

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=20020312170616.GA20479@logica.com \
    --to=okiddle@yahoo.co.uk \
    --cc=pws@csr.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).