Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to parse zsh history
- X-seq: zsh-users 27873
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-user <zsh-users@xxxxxxx>
- Subject: Re: How to parse zsh history
- Date: Thu, 7 Jul 2022 14:46:18 +0100 (BST)
- Archived-at: <https://zsh.org/users/27873>
- Importance: Normal
- In-reply-to: <1728479877.503410.1657201438041@mail.virginmedia.com>
- List-id: <zsh-users.zsh.org>
- References: <CAHAhJwK9F30y8D47z-ZbE5F02xsxuOUhzG6HkGWgytXjKd+ZSQ@mail.gmail.com> <1728479877.503410.1657201438041@mail.virginmedia.com>
Sorry, *still* don't know how to reply to everybody...
On 07/07/2022 06:56 Ahmad Ismail <ismail783@xxxxxxxxx> wrote:
> I am working on a widget for fuzzy search history.
I guess you want some variation on
print -l ${history[(R)*(#a2)stuffhere*]}
--- to be clear, this is outputting all history lines that are in shell
memory that contain a string "stuffhere" with up to two approximations.
I should have a play with that and let us know where you get stuck.
$history is in the standard zsh/parameter module, so since you almost
certainly have completion loaded it should be available already.
If you need to load from files before search, fc has numerous options
for that, including one to load to a local context so you don't pollute
the global history.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author