Skip to content

Instantly share code, notes, and snippets.

@timcharper
Last active October 24, 2015 12:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timcharper/c8d8bb01b3a13e5f68f4 to your computer and use it in GitHub Desktop.
Save timcharper/c8d8bb01b3a13e5f68f4 to your computer and use it in GitHub Desktop.
Better evil word behavior
(defun forward-evil-word (&optional count)
""
(let ((init-point (point)))
(forward-symbol (or count 1))
(if (= (point) init-point)
count 0)))
(setq evil-symbol-word-search t)
@almost
Copy link

almost commented Dec 29, 2014

Thanks for this, the new behaviour was really annoying me!

@timcharper
Copy link
Author

I updated the gist; turns out there is a setting for evil to use symbol instead of words as the #/* searching; also, changing forward-evil-word to just use the implementation for forward-symbol gives even closer emulation to VIM (edit an emacs file and see that - is treated as a word character).

Digging this; short, sweet and accurate.

@timcharper
Copy link
Author

Actually, it turns out that my previous one was more accurate :/

@agriffis
Copy link

agriffis commented Apr 6, 2015

evil-symbol-word-search works for #/* searching, thanks!

Do you find that forward-symbol actually does what you want for word movement? I find it jumping over places I expect w to stop, for example:

FOO_BAR = 1

With point on F, pressing w jumps to 1 rather than stopping on =.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment