From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1861 invoked from network); 6 May 2002 12:35:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 May 2002 12:35:56 -0000 Received: (qmail 24881 invoked by alias); 6 May 2002 12:35:33 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4919 Received: (qmail 24870 invoked from network); 6 May 2002 12:35:32 -0000 X-Authentication-Warning: roman.mobil.cz: roman set sender to neuhauser@mail.cz using -f Date: Mon, 6 May 2002 14:51:57 +0200 From: Roman Neuhauser To: zsh users Subject: Re: history expansion Message-ID: <20020506125157.GQ325@roman.mobil.cz> Mail-Followup-To: zsh users References: <20020430163319.GV325@roman.mobil.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.26i > Date: Tue, 30 Apr 2002 09:43:14 -0700 (PDT) > From: Bart Schaefer > To: Roman Neuhauser > cc: zsh users > Subject: Re: history expansion > > On Tue, 30 Apr 2002, Roman Neuhauser wrote: > > > Is there a way ^foo^bar substitution could replace all occurrences of > > foo in the preceding event like !!:gs/foo/bar/? > > Not in the way you think, no. ^foo^bar is, very literally, shorthand for > !!:s^foo^bar -- there's no provision for inserting a `g' to the left of > the leftmost carat. > > However, you can always create a special ZLE widget. The following is > pretty much exactly what the history code does: > > function insert-bangbang-gs-and-accept { > setopt localoptions noksharrays noshwordsplit > [[ $BUFFER[1] == $histchars[2] ]] && BUFFER='!!:gs'$BUFFER > zle .accept-line > } > zle -N insert-bangbang-gs-and-accept thanks, that's just what I needed. I use setopt histverify, so I changed the .accept-line to .expand-history. but this got me thinking: how would one check for an option value in a function? -- FreeBSD 4.4-STABLE 2:50PM up 7 days, 5:15, 15 users, load averages: 0.17, 0.09, 0.02