How to use Ctrl+left/Ctrl+Right (instead of Alt+left/Alt+right) to move to the previous/next word

On a Mavericks system, I would like to use Ctrl+left/Ctrl+right instead of Alt+left/Alt+right to move to the next word or the previous word.

Mission Control is not using Ctrl+left/Ctrl+right (I changed that from the default value).

Is it possible to do this with some system setting (i.e. without a keymapper)?


You can use KeyRemap4MacBook with a private.xml such as this:

<?xml version="1.0"?>
<root>
  <item>
    <name>⌃← & ⌃→ to ⌥← & ⌥→</name>
    <identifier>remapCtrlLeftAndCtrlRightToAltLeftAndAltRight</identifier>
    <autogen>
      __KeyToKey__
      KeyCode::CURSOR_LEFT, VK_CONTROL | ModifierFlag::NONE,
      KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L
    </autogen>
    <autogen>
      __KeyToKey__
      KeyCode::CURSOR_RIGHT, VK_CONTROL | ModifierFlag::NONE,
      KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L
    </autogen>
  </item>
</root>

I'm not aware of any System Preferences setting regarding this.


With regard to comment, change the contents of the <autogen> to…

__KeyToKey__
KeyCode::CURSOR_LEFT, VK_OPTION | ModifierFlag::NONE,
KeyCode::CURSOR_LEFT, ModifierFlag::CONTROL_L
__KeyToKey__
KeyCode::CURSOR_RIGHT, VK_OPTION | ModifierFlag::NONE,
KeyCode::CURSOR_RIGHT, ModifierFlag::CONTROL_L

Another option is to create ~/Library/KeyBindings/ and save a property list like this as ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
   "^\UF700" = moveWordUp:;
   "^\UF701" = moveWordDown:;
   "^\UF702" = moveWordLeft:;
   "^\UF703" = moveWordRight:;
   "^$\UF700" = moveWordUpAndModifySelection:;
   "^$\UF701" = moveWordDownAndModifySelection:;
   "^$\UF702" = moveWordLeftAndModifySelection:;
   "^$\UF703" = moveWordRightAndModifySelection:;
}

Quit and reopen applications to apply the changes.

More information:

  • http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html
  • http://osxnotes.net/keybindings.html