Slim Joe | 21 Sep 04:22

Wildcard history search

I'm just wondering if zsh has a tcsh feature that I find very
convenient. It's the ability to search the history list using
wildcards. For example, I have issued the following commands:

[107] echo brown is the fox
brown is the fox
[108] echo the fox is brown
the fox is brown

In order to match [107] without going through [108], I only need to type:

[109] *x<Meta-P>

The "*x" will match the command containing the terminal word "fox"
[107] and not [108] which contains the word "fox" in the middle. To
explicitly match [108], I type "*n<Meta-P>", that is *{brow}n

Fancier combinations can exist like "??ho*<Meta-P>" which will match
{ec}ho{*} or "*{brown,fox}<Meta-P>" to math all commands the end with
either "brown" or "fox".

Bart Schaefer | 21 Sep 08:27

Re: Wildcard history search

On Sep 21, 11:25am, Slim Joe wrote:
}
} I'm just wondering if zsh has a tcsh feature that I find very
} convenient. It's the ability to search the history list using
} wildcards.

You want to bind the widgets history-incremental-pattern-search-backward
and history-incremental-pattern-search-forward to some keys, I think.

Availability does depend on your version of zsh, they're relatively
recent additions.


Gmane