Last Updated: February 25, 2016
·
615
· railsbros-dirk

Pattern based history search in zsh

The history feature in zsh (or any other shell) is crucial for me. A lot of stuff I need to execute on a regular basis is stored there. Thus I need to search for commands in an efficient way. While the default history search is still good I want something more sophisticated for more complex commands: A pattern based search.

bindkey '^r' history-incremental-pattern-search-backward
bindkey '^f' history-incremental-pattern-search-forward

With this you can hit CTRL-R, type curl*3000 and you will find something like curl http://localhost:3000/ponies.

I find this extremely helpful and maybe it is good for you too.

Cheers
Dirk