2

When searching for text in evil mode using / key, then entering text. The value searched for isn't saved as it is in vim, where the up/down arrow keys can cycle search history.

Is it possible for emacs/evil mode to store each search as it does with : commands?


Update, isearch keys aren't configured for vim-like behavior.

I looked into this and the isearch keymap can be modified, will add own answer.

1

2 Answers 2

6

You will find things more Vim like with the Evil search module rather than isearch search module with Evil :

(evil-select-search-module 'evil-search-module 'evil-search)
2
  • Thanks, I needed to follow steps in this answer to get it working - stackoverflow.com/a/34252236/432509
    – ideasman42
    Commented Mar 9, 2017 at 18:26
  • Note that using this disables case sensitivity... checking on how to resolve.
    – ideasman42
    Commented Mar 10, 2017 at 6:01
1

To have up/down arrow keys cycle history as with vim, you can define isearch keymap.

(define-key isearch-mode-map (kbd "<down>") 'isearch-ring-advance)
(define-key isearch-mode-map (kbd "<up>") 'isearch-ring-retreat)
2
  • Nice answer as it allows to use the usual editing hotkeys you may have configured, while the caret is inside the regexp line. The 'evil-search from the other answer has its own hotkeys.
    – Hi-Angel
    Commented Dec 7, 2022 at 13:27
  • Note that using the arrow keys right after a search (while the isearch highlight is still active) will not work correctly.
    – trxgnyp1
    Commented Jun 17 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.