Re: history expansion

Bart Schaefer <[email protected]> Tue, 14 Jul 2026 13:06:17 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAH+w=7YiEiJYM90WnqG15Dyv8+j+N=8Jex_rN7j8GWUNEud4ig@mail.gmail.com>
On Tue, Jul 14, 2026 at 3:42=E2=80=AFAM Vincent Lefevre <[email protected]=
> wrote:
>
> Don't you use the same customization on all your machines?

I do a lot of work on auto-scaled cloud instances, it's not practical
to install zsh and export configuration to them.

> > Even though the contributed replace-string function exists, using it
> > doesn't save many keystrokes over !!:gs/foo/bar ... and oddly it
> > doesn't default to acting on the immediately previous command line the
> > way replace-argument does.
>
> How do you use this? Doesn't !!:gs/foo/bar occur at the beginning
> of the line?

Yes, !!:gs is at the beginning of the line.  Sometimes it's something
like !-2:gs, but more rarely it's !*:gs where a new command name is
the first word on the line.

> My problem was more with things like
>
>   echo "foo!"

You probably know this: history expansion takes place inside "..." but
not inside '...'.