evil icon indicating copy to clipboard operation
evil copied to clipboard

evil-forward-word-begin doesn't work with superword-mode

Open TheBB opened this issue 9 years ago • 3 comments

Originally reported by: arianaut (Bitbucket: arianaut, GitHub: Unknown)


superword-mode, which ships with Emacs, changes symbol characters like underscore into word characters (so forward-word, backward-word skip over them).

However, evil-forward-word-begin behaves erratically on words containing underscores when superword-mode is enabled.


  • Bitbucket: https://bitbucket.org/lyro/evil/issue/721

TheBB avatar Oct 19 '16 22:10 TheBB

I am experiencing this issue as well.

If it helps, I found that disabling superword-mode and using this workaround helps: https://emacs.stackexchange.com/a/27350/2676

;; For python
(add-hook 'python-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
;; For ruby
(add-hook 'ruby-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
;; For Javascript
(add-hook 'js2-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))

which allows evil-mode to consider _ as part of the word. It's not a great solution, but it somewhat mimics superword-mode

modulitos avatar Aug 02 '19 21:08 modulitos

That workaround actually does not work. If a line contains "_" near its end (in combination with a handful of other symbols or by itself), the cursor will still get stuck there.

johanatan avatar Feb 13 '20 20:02 johanatan

Hi, has there been any progress on this issue? It is also affecting me.

jleonard-r7 avatar Feb 13 '21 15:02 jleonard-r7