Difference between revisions of "Subword-mode"

From WikEmacs
Jump to: navigation, search
(added a basic page on subword-mode)
 
(See Also: string-inflection package, to toggle name styles)
 
Line 60: Line 60:
  
 
* [[CamelCase]]
 
* [[CamelCase]]
 +
* [http://melpa.milkbox.net/#/string-inflection String-inflection], a [[Melpa]] package that permits to toggle between the underscore, UPPERCASE and CamelCase name styles.
  
 
[[Category:Programming]][[Category:Convenience]][[Category:Built-in Package]]
 
[[Category:Programming]][[Category:Convenience]][[Category:Built-in Package]]

Latest revision as of 04:04, 6 May 2014

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[edit]

(subword-mode +1)

Helpful keybindings[edit]

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[edit]