6

Cmd + is not finger-friendly for me. So I wonder any other way without the 4-arrow-key to do the same, any one will be appreciated.

System: MacOS X El Capitan Version 10.11.6

Usage: move the cursor in any form on the web like Google Search, when text is visually selected, I want to move the cursor to the end of the line to append something.

I do be a little picky because I just learned Vim recently. Thanks all reply!

  • Please add your system version, your Mac model and the app(s) you are using. – klanomath Dec 8 '16 at 13:21
  • 1
    If you had a Windows machine, just hit the 'End' key. So much more productive! ;) – dave k Dec 8 '16 at 19:51
  • @davek Hahaha, that's just what my teacher said!! – Niing Dec 9 '16 at 6:35
19

I am using Ctrl+e to move to the last letter and Ctrl+a to move to the first letter.

Remember that Emacs commands, work also in the Terminal.

  • 6
    Not only do the Emacs-style shortcuts work in the Terminal, but they work in any standard text box control. If they don't work, it means that the app is not using the Apple-provided UI library, and you don't get all these nice behaviors. :-( – Cody Gray Dec 8 '16 at 15:49
  • It may in fact even work on iOS, if you're using an external keyboard with ctrl on it. – Williham Totland Dec 8 '16 at 18:22
  • Wow, that's what I want! I used to do the same with stupid <option><left-arrow>... – Niing Dec 9 '16 at 6:38
  • It doesn't work at my language input method, but! I love English and always search my question through Stack Overflow with English, so ... question solved! Thanks!! – Niing Dec 9 '16 at 6:44
4

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.

  1. So download and install the app (direct d/l link)
  2. Open in the menulet Karabiner -> Preferences
  3. Open the tab Misc & Uninstall
  4. Hit the button Open private.xml
  5. Open the file private.xml with an appropriate editor
  6. Enter a customized keycode. In my example I remapped the right command key to

    <?xml version="1.0"?>
    <root>
        <item>
        <name>Change Command R to Command L arrow</name>
        <identifier>cmdr2cmdlarrowr</identifier>
        <autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
        </item><!-- note the closing </item> tag-->
    </root>
    
  7. Save the file

  8. Open in the menulet Karabiner -> Preferences the tab Change Key
  9. Hit the ReloadXML button
  10. 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.

  • Before I got @lan 's answer I searched and found the just same tool you mentioned, and noticed that compatibility issue you mentioned, and considered using it! still thanks for you and hope your answer will help those considering using it. – Niing Dec 9 '16 at 7:02
0

Ctrl-e, like in Emacs. Many Emacs keybindings will also work: Ctrl-a to go to beginning of line, Ctrl-f for forward and Ctrl-b for back.

You must log in to answer this question.

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