I wonder whether it is possible to make f in evil and/or in evil-easymotion case insensitive?

1 Answer 1


There is no setting to do this for Evil's f. If you inspect the command's definition you'll find that it binds case-fold-search to nil which makes Emacs treat search results case-sensitively. What you can do here is copying its definition, renaming the command and changing the value of case-fold-search to t, then binding the renamed command to the original key:

(evil-define-motion my-evil-find-char (count char)
    "Move to the next COUNT'th occurrence of CHAR.
Movement is restricted to the current line unless `evil-cross-lines' is non-nil."
    :type inclusive
    (interactive "<c><C>")
    (setq count (or count 1))
    (let ((fwd (> count 0)))
      (setq evil-last-find (list #'evil-find-char char fwd))
      (when fwd (forward-char))
      (let ((case-fold-search t))
        (unless (prog1
                    (search-forward (char-to-string char)
                                    (unless evil-cross-lines
                                      (if fwd
                                    t count)
                  (when fwd (backward-char)))
          (user-error "Can't find %c" char)))))

(with-eval-after-load 'evil
  (define-key evil-motion-state-map (kbd "f") 'my-evil-find-char))

Exercise left to the reader: Doing the equivalent for F and easy-motion commands.

  • Thanks. I don't quite understand all of the stuff in the evil-easymotion, I've tried to replace the function names with my-evil-find-char but couldn't make it work. I guess it would take a bit of effort. BUT. I have just renamed your function to evil-find-char, load it after evil and it seems that it has over-written the original function. And it works perfectly fine with evil-easymotion. I suppose it's not a good idea to over-write stuff but it works fine for this purpose.
    – Arktik
    Nov 8, 2018 at 11:15

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.