I spend a very large amount of time editing text in Xcode, and I would like maneuvering around text within the rest of the Cocoa Text System to offer an identical experience. There are 3 versions of cursor keyboard shortcuts that I use regularly in Xcode (only showing forward, non-selection-altering versions for brevity):

  1. +Move cursor 1 subword forward (^camelCase -> camel^Case -> camelCase^)
  2. ⌥ Option+ Move cursor 1 word forward
  3. ⌘ Command+ Move cursor to the end of the line

The OS X default keybindings respect 2 and 3, but there is a disparity with 1. Outside of Xcode, + behaves like ⌘ Command+. It's not applicable terribly often, but every time + takes me to the end of a line in Mail or something, it's like a little firecracker goes off in my brain. It's just annoying enought that I'm willing to invest in any hackery to "fix" the behavior once and for all.

To avoid covering old ground, I'm already aware of this little tidbit, and this list of selectors, but I'm not aware of any API in the Cocoa Text System for subword selection. Maybe there's undocumented API in there somewhere?

I don't always attempt to make camelCase selections outside of Xcode with keyboard shortcuts, but when I do I want OS X to obey.

  • 2
    On my mac ⌃→ switches spaces by default, and it does not behave like ⌘→ Commented Jun 11, 2014 at 14:31
  • 2
    This assumes you've disabled that shortcut in System Preferences. Commented Jun 14, 2014 at 0:26
  • Nope. On OS X (Mavericks) the default behaviour of ⌃→ is switches spaces. osxdaily.com/2011/09/06/… Commented Jun 14, 2014 at 7:40
  • Want it too. I think there is can be an external tool like Yandex' PuntoSwitcher to manipulate input cursor in any text box. Commented Aug 18, 2014 at 12:49

2 Answers 2


Sorry but what you want is not possible.

You could try adding the XCode keybindings that do this

"^\UF702" = "moveSubWordBackward:";                     /* Ctl-Left Arrow */
"^$\UF702" = "moveSubWordBackwardAndModifySelection:";  /* Ctl-Shift-Left Arrow */
"^\UF703" = "moveSubWordForward:";                      /* Ctl-Right Arrow */
"^$\UF703" = "moveSubWordForwardAndModifySelection:";   /* Ctl-Shift-Right Arrow */
"^\177" = "deleteSubWordBackward:";                     /* ctl-delete */
"^\UF728" = "deleteSubWordForward:";                    /* ctl-forwardDelete */

into your ~/Library/KeyBindings/DefaultKeyBindings.dict file but unless the application is written to respond to these methods, it won't work. As you've said, these methods are not part of the standard Text System so these calls in an app will just go unanswered or you will get a system beep.


To navigate camel case (aka sub-words) to the right use

^ + [ to move a sub-word to the left

^ + ] to move a sub-word to the right

I confirmed this in OSX 10.10.1 running Xcode 6.1.1.

  • I think the gist of this question is to get the Xcode sub-word commands outside that one app and on the rest of the standard apps.
    – bmike
    Commented Dec 22, 2014 at 21:31
  • @bmike, perhaps it is. If so, one would probably have to code this because the feature is inherent to Xcode and not the OS. But one would hope that an Xcode user would know that.
    – SaxDaddy
    Commented Dec 23, 2014 at 2:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .