The best ZSH history search

Sean Lewis
2 min readSep 28, 2021
oh my zsh rocks

It is often hard to remember all the shell commands you need on the day-to-day. It is often tedious to type out the long commands that you use over and over again. It becomes confusing to remember all the little aliases you’ve set up.

Fret no more, enter oh-my-zsh and zaw.

Zaw’s a little odd to get setup properly, IMO, so here’s a small guide.

cd ~/.oh-my-zsh/plugins;
git clone git://;echo "source ${PWD}/zaw/zaw.zsh" >> ~/.zshrc
  • Edit your ~/.zshrc file
  • Replace your plugins section with this (feel free to add whatever other plugins you’re using)
plugins=(git zaw) # just need to add zaw to plugins
# this has to be before bindkey IME
source $ZSH/
# CTRL-R will pull up zaw-history (backwards zsh history search)
bindkey '^r' zaw-history
# CTRL-B will pull up zaw-git-branches which will search your current git branches and switch (git checkout) to the branch you select when you hit enter.
bindkey '^b' zaw-git-branches
  • Restart your terminal/zsh session!

Now hitting Control+r will start the zaw-history search where you can filter your zsh history to your heart’s content. The arrow keys should work to navigate up and down the list. All of Zaw’s keybindings can be found here.
Hitting Control+b will start the git branch search for the git project you’re currently in which enables very fast git branch switching!

Zaw has a litany of other functionality listed here.
If you have any questions or comments let me know! Happy searching!