Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: history expansion



On 2026-07-12 13:54:15 -0700, Bart Schaefer wrote:
> On Sun, Jul 12, 2026 at 6:42 AM Mark J. Reed <markjreed@xxxxxxxxx> wrote:
> >
> > I use history substitution all the time.
> 
> I do as well, because I spend a significant portion of my time using
> bash on virtual hosts where zsh is not installed and it would be
> counterproductive to customize it.  Muscle memory for !! et al. is
> more valuable than ZLE (or readline) customization.

Don't you use the same customization on all your machines?

> 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?

Note: I do not think that there is any issue with history expansion
when the input starts with "!" (not followed by a space) as this
would be very unusual for a normal command. My problem was more with
things like

  echo "foo!"

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author