Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history expansion
- X-seq: zsh-users 4900
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Roman Neuhauser <neuhauser@xxxxxxx>
- Subject: Re: history expansion
- Date: Tue, 30 Apr 2002 09:43:14 -0700 (PDT)
- Cc: zsh users <zsh-users@xxxxxxxxxx>
- In-reply-to: <20020430163319.GV325@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: schaefer@xxxxxxxxxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author