I'd like to search in buffer with the same fuzzy style that turns the search string into a regexp that splits characters and joins them with .*, like in Helm command search.

Is there a way to do this for evil-search-forward and evil-search-backward in Spacemacs?

  • 1
    These are implemented in terms of isearch, so if you find something working for that, it shouldn't be hard to change Evil to do the same thing.
    – wasamasa
    Oct 10, 2017 at 5:10
  • 1
    Does it have to be done by evil-search-forward? Have you tried helm-swoop? (I'm not entirely sure that does exactly fuzzy search, because I use ivy instead of helm) SPC h d f helm-swoop to see what key sequence that's bound to (SPC s s, I'm guessing? With ivy selected, that runs swiper -- in fact so did C-s I think, before I rebound that). Nov 11, 2017 at 22:20
  • 1
    I didn't know about helm-swoop, but yes, it is bound to SPC s s (very convenient). It doesn't come with fuzzy find by default, but it does have an option (setq helm-swoop-use-fuzzy-match t), so that solved it for me. I don't know if I should leave the question open in case someone wants the specific answer, but if you post yours I will accept it. Thank you! Nov 12, 2017 at 17:27

1 Answer 1


Leaning on the built-in isearch, the custom variable search-whitespace-regexp and these key bindings works pretty well for me.

(custom-set-variables '(search-whitespace-regexp ".*"))
(evil-define-key '(normal) 'global "/" (lambda () (interactive) (isearch-forward)))
(evil-define-key '(normal) 'global "?" (lambda () (interactive) (isearch-backward)))
(evil-define-key '(normal) 'global "n" (lambda () (interactive) (isearch-repeat-forward)))
(evil-define-key '(normal) 'global "N" (lambda () (interactive) (isearch-repeat-backward)))

Or you can use swiper (which I think does fuzzy matching by default) but it's pretty slow and I don't need the preview feature. But it worked fine for me in the past.

Note: In the above example, "n" and "N" don't behave exactly like evil mode since they always go in the same direction every time. You can easily configure that though.

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.