An appropriate tool to modify shortcuts or keybindings is Karabiner. Be aware that until now (Dec 2016) the app is not compatible with 10.12 Sierra.
- So download and install the app (direct d/l link)
- Open in the menulet Karabiner -> Preferences
- Open the tab Misc & Uninstall
- Hit the button Open private.xml
- Open the file private.xml with an appropriate editor
Enter a customized keycode. In my example I remapped the right command key to ⌘→
<name>Change Command R to Command L arrow</name>
<autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
</item><!-- note the closing </item> tag-->
Save the file
- Open in the menulet Karabiner -> Preferences the tab Change Key
- Hit the ReloadXML button
- Enable the remapping. It should be listed at the beginning.
Then you can't use the right command key for anything else, so choose the keys wisely!
If you replace the line starting with
<autogen>__KeyToKey__ by this line:
<autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_R, KeyCode::VK_LAZY_COMMAND_R, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
you can use the right command key almost as usual. Just hitting the key, will move the cursor to the end of the line.
You can also use the right alt/option key. Then replace COMMAND_R by OPTION_R and VK_LAZY_COMMAND_R by VK_LAZY_OPTION_R.