From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5489 invoked from network); 30 Apr 2002 16:44:03 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 30 Apr 2002 16:44:03 -0000 Received: (qmail 18091 invoked by alias); 30 Apr 2002 16:43:46 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4900 Received: (qmail 18080 invoked from network); 30 Apr 2002 16:43:44 -0000 Date: Tue, 30 Apr 2002 09:43:14 -0700 (PDT) From: Bart Schaefer Sender: schaefer@ns1.sodaware.com To: Roman Neuhauser cc: zsh users Subject: Re: history expansion In-Reply-To: <20020430163319.GV325@roman.mobil.cz> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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