Not being satisfied with side-effects of evil-symbol-word-search
or having to applyhardcode (modify-syntax-entry)
explicitly tofor every mode, I found that apparently minor mode hooks are run after major mode syntax table is created. That meansSo you can add a hook to modify syntax table to evil-mode
hook and it should just work.
(defun myhook-evil-mode ()
(unless;; (orI (memberwant majorunderscore be part of word syntax table, but not in regexp-replace buffer
;; where I'm more comfortable having more verbose navigation with underscore not
;; being a part of a word. To achieve this I check if current mode has a syntax
;; table different from the global one. The `(eq)' is a lightweight test of whether
;; the args point to the same object.
(special-modeunless fundamental-mode(eq lisp(standard-interactionsyntax-mode)table) (minibufferpsyntax-table))
;; make underscore part of a word
(modify-syntax-entry ?_ "w")))
(add-hook 'evil-local-mode-hook 'myhook-evil-mode)
Maybe not optimal as it's executed every time a new buffer is created, but shouldn't matter in this case. What does though is that this allowed me to get rid of a humongous 49 lines paragraph that was modifying syntax table of every possible mode I got to work with.