Navigate up & down in / search history when evil-set-initial-state is set to 'emacs ?

Vasilij Schneidermann v.schneidermann at gmail.com
Wed Mar 15 10:38:58 CET 2017


Hello John,

> For some modes I find it more convenient to be in Emacs state and add
> some key Evil mappings as needed, like so:
> 
>     ;; start the Package Menu in Emacs mode, add some Evil mappings
>     (evil-set-initial-state 'package-menu-mode 'emacs)
>     (evil-add-hjkl-bindings package-menu-mode-map 'emacs
>       (kbd "/")       'evil-search-forward
>       (kbd "n")       'evil-search-next
>       (kbd "N")       'evil-search-previous)

Interesting, for Emacs state bindings I'd have modified the underlying
keymap directly like so:

    (with-eval-after-load 'package
      (define-key package-menu-mode-map (kbd "/") 'evil-search-forward)
      ...)

> This works quite nicely, except for one thing, I'm not finding a
> way to Navigate up & down in the search history initiated by /
> ('evil-search-forward). I have in my init file this:
> 
>     (setq evil-search-module 'evil-search)
> 
> Which allows such navigation through search history -- but only when
> in Evil vi states, not when evil-set-initial-state is set to 'emacs.
> 
> Any suggestions re how to achieve this in Emacs state?

Could you please elaborate on the exact workflow?  This sounds to me as
if you want to initiate a search with `evil-search-forward`, then switch
out the currently entered search term (which can be done with `M-p` and
`M-n` already) and continue your session.  These keys are bound to
`isearch-ring-retreat` and `isearch-ring-advance`.  But perhaps I'm
misunderstanding you and you're envisioning a different workflow, like
one not requiring to be in a search session for changing the search
item.

Cheers
Vasilij Schneidermann



More information about the implementations-list mailing list