When writing code in
python-mode my preference would be to include underscores within a word boundary, so
variable_with_underscores is treated as a single word.
How would I limit my word preference only to
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
It's bird, it's a plane, it's
Superword mode is a buffer-local minor mode. Enabling it changes the definition of words such that symbols characters are treated as parts of words: e.g., in ‘superword-mode’, "this_is_a_symbol" counts as one word.
It's a minor mode, so you can set it in a hook the normal way:
(add-hook 'python-mode-hook #'superword-mode).
superword-mode has only existed since 24.4, so you'll need to hack the syntax table by hand in older versions.
I find it very convenient to bind this to a key so I can easily toggle it. It's the sort thing I want sometimes, but not others.