3

I don't isearch backwards frequently enough to justify giving it such a valuable keybinding, so I rebound isearch-backward-regexp to C-c r and I noticed that something strange started happening. Normally isearch-backward-regexp will use the previous search string and jump to the previous match if you hit C-r twice, but the search string in the minibuffer always cleared when you rebind isearch-backward-regexp to a compound keybinding.

Greg Nisbet
  • 877
  • 5
  • 19

1 Answers1

4

This is because normally when you repeat an isearch command it executes the isearch-repeat-forward or isearch-repeat-backward command to save your search string (you can find this out by doing C-h k in the minibuffer). The following should fix this for your keybind:

(define-key isearch-mode-map (kbd "C-c r") 'isearch-repeat-backward)

whacka
  • 383
  • 1
  • 6