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

Re: How to parse zsh history



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