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.
evil-search-forward
? Have you triedhelm-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? Withivy
selected, that runsswiper
-- in fact so didC-s
I think, before I rebound that).helm-swoop
, but yes, it is bound toSPC 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!