ohmyzsh: "^r" search not working

For me the search is not working unless I manually do

  source ~/.zshrc

I have no idea why it is that way but actually the second line in key-bindings.zsh does not make any sense to me.

I already commented on the commit but no one noticed.

Please fix that as searching already executed commands is a very useful feature.

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 17 (15 by maintainers)

Commits related to this issue

Most upvoted comments

The vi-mode plugin switches the key bindings to vi-mode from the default emacs-mode, search for the following line:

 bindkey -v

Thus you need to use the vi search commands and not the emacs ones…

ESC ? <search string>
ESC / <search string>

ESC puts you in command mode (from the default vi insert mode) and the ? starts a backward search, while / starts the forward search. You can then use n to find the next search match.

But the big difference is that this isn’t an incremental search, you have to type the whole search string and then ENTER before you see if there is a match.

To restore the ^R incremental search add the following to the bottom of your .zshrc file:

bindkey \C-R history-incremental-search-backward

(note if you are typing that from the command line you’ll need to escape the \ with an extra \.

thanks to everyone on this thread, was very concerned when C-R spontaneously stopped working

at least on my system, i needed a slightly different syntax bindkey "^R" history-incremental-search-backward

not sure why, but the following didn’t work for me bindkey \C-R history-incremental-search-backward

system is mac os x 10.14 (el capitan)