From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4655 invoked from network); 12 Mar 2002 17:06:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Mar 2002 17:06:56 -0000 Received: (qmail 2394 invoked by alias); 12 Mar 2002 17:06:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16814 Received: (qmail 2383 invoked from network); 12 Mar 2002 17:06:45 -0000 X-VirusChecked: Checked Date: Tue, 12 Mar 2002 17:06:16 +0000 From: Oliver Kiddle To: Bart Schaefer Cc: Peter Stephenson , Zsh hackers list Subject: Re: PATCH: Re: insert-last-word/copy-prev-word/... question Message-ID: <20020312170616.GA20479@logica.com> References: <21415.1015339730@csr.com> <1020306182111.ZM23061@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1020306182111.ZM23061@candle.brasslantern.com> User-Agent: Mutt/1.3.27i Sender: Oliver Kiddle 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.