Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Blog / Emacs tips: Navigate CamelCase

Emacs tips: Navigate CamelCase

by Ross Patterson last modified Sep 09, 2012 09:00 PM
M-f, M-b, M-d, <M-backspace> over camelCase!

Update 2: See comment below about c-subword-mode being renamed to subword-mode.

Update: See the comment below about using subword-mode. It's already included in my emacs at least, and it seems to be a bit better supported. camelCase-mode seems to conflict with org-mode at least.

I'm terribly behind on my blogging but I wanted to re-post this nice little tidbit from Planet Python for those who aren't on it already. The camelCase-mode for emacs allows you to do most word based operations over the separate words that make up a camel case word.

I've been needing something like this for some time. As an emacs junkie, I've gotten quite accustomed to being able to move point pretty much directly where I want it in just a few key strokes. Camel case words, however, can get quite long so correcting a typo or changing a plural in one of the constituent words can leave me reaching for my mouse of hammering away at C-f or C-b. Simply unacceptable! :)

So I downloaded camelCase.el to /usr/local/share/emacs/site-lisp and then added the following to my .emacs:

(require 'camelCase)
(add-hook 'find-file-hook 'camelCase-mode)

Ta da! CamelCaseGoodness!

Navigation
OpenID Login

Contact

me@rpatterson.net

IRC: zenwryly@irc.freenode.net
plone.org: rossp
GTalk: mer@patterson.net
Yahoo IM: patterson_ross
AIM: rosspatters
MSN: me@rpatterson.net
Skype: merpattersonnet

PO Box 7775 #10587
San Francisco, CA
94120-7775

Phone
+1 (415) 894-5323