Raghu
Raghu

Reputation: 2134

Change forward-word/backward-word/kill-word for CamelCase Words in Emacs

I need to ability to navigate and edit parts of a camel cased word in Emacs. Functionality similar to camel humps in Intellij IDEA. For example I need Blah,Foo and Bar in the string BlahFooBar to be identified as 3 separate words so I could navigate/edit them like they are separate words.

I have tried playing with syntax table

(modify-syntax-entry ?A ".")
(modify-syntax-entry ?F ".")

This has the effect of making lah, oo, and ar words and chars B and F word separators. So the navigation backwards (and backward-kill-word) does not work as expected.

What I need is word boundaries based on regex and not a separator.

Upvotes: 10

Views: 1307

Answers (3)

Andreas Röhler
Andreas Röhler

Reputation: 4804

Get py-forward-, resp. py-backward-into-nomenclature from python-mode.el

It works with any mode

https://launchpad.net/python-mode/+download

Upvotes: 1

user797257
user797257

Reputation:

M-xsubword-mode should do exactly that.

Upvotes: 22

Raghu
Raghu

Reputation: 2134

The solution seems to be camelcase mode. http://www.eecs.ucf.edu/~leavens/emacs/camelCase/camelCase-mode.html

Upvotes: 0

Related Questions