Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using history / fc for case-insensitive pattern matching
- X-seq: zsh-users 27529
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Using history / fc for case-insensitive pattern matching
- Date: Mon, 21 Feb 2022 22:01:24 +0100
- Archived-at: <https://zsh.org/users/27529>
- In-reply-to: <CAMP9c5n=NQ6myLatuLTcNJ71PxDdTqGMbPrDArPVSABOskmiqA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5n=NQ6myLatuLTcNJ71PxDdTqGMbPrDArPVSABOskmiqA@mail.gmail.com>
On 2/21/22, Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> I've written a neat little tool that wraps "fc" / "history" to make
> everything look neat and easily documentable for later reference /
> incident response.
>
> $ command echo 'Hello, zsh-users!'
> Hello, zsh-users!
>
> $ hgrep zsh-u
> # [2021-12-18 06:13]
> git clone https://github.com/zsh-users/zsh.git
>
> # [2022-02-21 11:39]
> command echo 'Hello, zsh-users!'
>
> The down-side of this is that it appears "fc ... -m expression" is
> case-sensitive. I expect that Zsh has excellent documentation on the
> patterns and how to make them case-insensitive but I haven't managed
> to find it yet. Most of what I've found seems to correspond to file
> globbing, which isn't what I'm trying to do here.
You can use (#i) to make a pattern case insensitive, eg
fc -m '(#i)*zsh-u*'
you may need to setopt extendedglob first.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author