Make zsh history search behave like bash reverse-i-search

  • In bash, pressing [CTRL]+[r] will open the reverse-i-search prompt.
  • How can I search the zsh history in a similar way?

Note: The search query will hit the middle of the full command only, instead of match at it's beginning as required by the normal zsh search.

1 Answer

To make zsh behave like bash when pressing [CTRL]+[r]:

# for non-pattern search like in bash bindkey "^R" history-incremental-search-backward` 

or

# for pattern search (the wildcard `*` will use zsh completion) bindkey "^R" history-incremental-pattern-search-backward 

Note: Add the line to your ~/.zshrc to make it permanent.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like