From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12622 invoked from network); 12 Jul 2000 16:56:03 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Jul 2000 16:56:03 -0000 Received: (qmail 16 invoked by alias); 12 Jul 2000 16:55:43 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3270 Received: (qmail 8 invoked from network); 12 Jul 2000 16:55:42 -0000 Date: Wed, 12 Jul 2000 18:38:58 +0200 (CEST) From: Christoph Lange Reply-To: Christoph Lange To: Bart Schaefer cc: zsh-users@sunsite.auc.dk Subject: Re: ZLE Widget: Insert last word (except &) In-Reply-To: <1000712082636.ZM9329@candle.brasslantern.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII > I wrote: > } If we don't accept the shell syntax definition of a "word", how can we > } choose a single definition of what constitutes a "word" that everyone > } will agree on? > > The answer is, we don't, we use a style. Which isn't (presently) ever done > with the builtin widgets, so you aren't going to see this as the default > behavior of insert-last-word any time soon. > > ---- 8< ---- cut ---- 8< ---- > # smart-insert-last-word > > [...] > > Note that this presently doesn't work right when the previous command line > contains a [[ ... ]] expression that uses one of the (#x) forms of extended > pattern matching, e.g. (#i) to ignore case. That's a bug in ${(z)...} (it > takes the # to be a comment introducer), so it should be fixed soon. If > this really bothers you in the meantime, try adding > > local +h histchars='' > > somewhere before the assignment to lastcmd -- but then it's broken for the > case of `setopt interactive_comments`, so choose your poison ... There is another bug in your version of smart-insert-last-word: repeated calls to it don't go back in the history. Rather than doing the word splitting yourself, you should always call insert-last-word -- with an argument of 2 or greater, when necessary. The solution might be a synthesis of my first version and yours -- a widget that is smarter than mine when determining the last word, but nevertheless calls insert-last-word, so that the shell can go back the history on subsequent calls. Christoph -- Descartes enters a pub. "Evening, Descartes. Same as usual?" Descartes says: "No, I think not." -- and disappears. Christoph Lange, langec@gmx.de, http://www.cul.de/home/yaph/, ICQ #51191833