Eclipse on Mac OSX - how to assign same shortcuts as on Windows?

5,241

Solution 1

Eclipse allows you change key bindings for commands. For example "Previous Word" command can be changed to Cmd + Left Arrow.

http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shortcut_for_my_action%3F

From the wiki...

Display and Edit the Current Keyboard Shortcuts

To see the current key configuration and its keyboard shortcuts, choose the Eclipse > Preferences menu command to open the Eclipse workbench Preferences. Select the General > Editor > Keys page.

Type "Previous Word" in the command search, then click on the "Binding" field. Then do the key (e.g. Cmd + left arrow) then apply.

Solution 2

Since eclipse ignores the DefaultKeyBindings.dict

https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x

I found the best way to do this is to configure eclipse to copy the existing key commands and add the windows short cuts. This allows both the standard mac short cuts to work and the windows shortcuts to work as well.

Eclipse > Preferences > General > Editor > Keys

Then search for:

"Line Start" map to the home button "Line end", choose copy command, and then click binding and hit the end key. "Previous word", same as above. "Next word", same as above.

If you end up mapping a key sequence to multiple commands in eclipse, eclipse will show you a little menu with the possible commands - you can then go back in a remove/remap the conflicting key sequence.

I also copied the commands to allow ctrl-c, ctrl-v windows commands to work for the edit category.

Share:
5,241

Related videos on Youtube

A.G.
Author by

A.G.

Updated on September 18, 2022

Comments

  • A.G.
    A.G. over 1 year

    How can I make Eclipse on Mac OS X to use the same text editing shortcuts as on Windows?

    Home: move to begin of line
    End: move to end of line
    Cmd+Left: move one word to the left
    Cmd+Right: move one word to the right
    

    I tried using betterTouchTool and remapped

    Home to Cmd+Left  (move to line begin) 
    Cmd+Left to Option+Left (move one word to the left)
    

    But the problem is now that when I press "Home", the cursor moves just one word to the left because Cmd+Left triggers Option+Left.

    The Eclipse Preferences do not allow to assign those shortcuts.

    Is there any solution?