Emacs: Move Cursor by camelCase, snake_case

By Xah Lee. Date: . Last updated: .
emacs subword-mode superword-mode camelCase snake case
emacs subword-mode, superword-mode

Alt+x subword-mode. It change all cursor movement/edit commands to stop in-between the “camelCase” words.

Alt+x superword-mode (emacs 24.4) is similar. It treats text like “x_y” as one word. Useful for “snake_case”.

subword-mode and superword-mode are mutally exclusive. Turning one on turns off the other.

To turn them on permanently, put in emacs init file:

;; move cursor by camelCase
(subword-mode 1) ; 1 for on, 0 for off

Subword mode is new in Emacs 23.2. [see Emacs 23.2 Features (released 2010-05)]

Patreon me $5 patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Patreon me $5. Ask me question on patreon