Subword-mode

From WikEmacs
Revision as of 04:14, 23 May 2012 by Bozhidar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Subword-mode is a buffer-local minor mode. Enabling it remaps word-based editing commands to subword-based commands that handle symbols with mixed uppercase and lowercase letters, e.g. "GtkWidget", "EmacsFrameClass", "NSGraphicsContext".

Here we call these mixed case symbols `nomenclatures'. Each capitalized (or completely uppercase) part of a nomenclature is called a `subword'. Here are some examples:

 Nomenclature           Subwords
 ===========================================================
 GtkWindow          =>  "Gtk" and "Window"
 EmacsFrameClass    =>  "Emacs", "Frame" and "Class"
 NSGraphicsContext  =>  "NS", "Graphics" and "Context"

The subword oriented commands activated in this minor mode recognize subwords in a nomenclature to move between subwords and to edit them as words.

Basic setup

(subword-mode +1)

Helpful keybindings

Subword-mode remaps common navigational commands to similar subword commands that are CamelCase aware.

<backward-kill-word> subword-backward-kill
<backward-word> subword-backward
<capitalize-word> subword-capitalize
<downcase-word> subword-downcase
<forward-word> subword-forward
<kill-word> subword-kill
<mark-word> subword-mark
<transpose-words> subword-transpose
<upcase-word> subword-upcase

See Also