From: Roman Neuhauser <neuhauser@mail.cz>
To: zsh users <zsh-users@sunsite.dk>
Subject: Re: history expansion
Date: Mon, 6 May 2002 14:51:57 +0200 [thread overview]
Message-ID: <20020506125157.GQ325@roman.mobil.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0204300927430.13668-100000@ns1.sodaware.com>
> Date: Tue, 30 Apr 2002 09:43:14 -0700 (PDT)
> From: Bart Schaefer <schaefer@brasslantern.com>
> To: Roman Neuhauser <neuhauser@mail.cz>
> cc: zsh users <zsh-users@sunsite.dk>
> 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
next prev parent reply other threads:[~2002-05-06 12:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-30 16:33 Roman Neuhauser
2002-04-30 16:43 ` Bart Schaefer
2002-05-06 12:51 ` Roman Neuhauser [this message]
2002-05-06 12:43 ` Borsenkow Andrej
2002-05-06 13:11 ` Roman Neuhauser
2002-09-25 10:33 Roman Neuhauser
2002-09-25 23:43 ` Bart Schaefer
2002-09-26 10:12 ` Roman Neuhauser
[not found] ` <20465.1033036099@csr.com>
2002-09-26 17:05 ` Bart Schaefer
2002-09-26 17:32 ` Roman Neuhauser
2020-02-20 12:44 Pier Paolo Grassi
2020-02-20 13:05 ` Vin Shelton
2020-02-20 13:19 ` Pier Paolo Grassi
2020-02-20 13:25 ` Vin Shelton
2020-02-20 13:29 ` Pier Paolo Grassi
2020-02-20 15:25 ` Mikael Magnusson
2020-02-20 15:31 ` Pier Paolo Grassi
2020-02-21 22:50 ` gi1242+zsh
2020-02-22 0:21 ` Pier Paolo Grassi
2020-02-22 0:36 ` Bart Schaefer
2020-02-22 1:01 ` Pier Paolo Grassi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020506125157.GQ325@roman.mobil.cz \
--to=neuhauser@mail.cz \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).