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.
-
I can't reproduce the problem.– Dan ♦Aug 27, 2015 at 17:52
1 Answer
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)