Configure Home/End key to move to start/end of line in IntelliJ

1

I know ctrl+right/ctrl+left will do that, but I am used to pressing Home/End and it's frustrating when it doesn't do it in IntelliJ. I use KeyRemap4Macbook which works great for terminal and elsewhere with the Home/End key setting, but the settings for some reason do not work in IntelliJ.

I am on MAC OSX, IJ 12.1.4.

Siddhartha

Posted 2013-08-22T16:42:10.387

Reputation: 527

Answers

0

So there are 2 settings in KeyRemap4MacBook:

enter image description here

Unchecking the first option, and keeping the 2nd checked allowed me to use Home/End in IJ.

Siddhartha

Posted 2013-08-22T16:42:10.387

Reputation: 527

2

IntelliJ IDEA doesn't seem to support ⌃A and ⌃E but it does support ⌘← and ⌘→. You could use this setting instead:

Or add something like this to private.xml:

<appdef>
  <appname>INTELLIJ</appname>
  <equal>com.jetbrains.intellij.ce</equal>
</appdef>
<item>
  <name>test</name>
  <identifier>test</identifier>
  <block>
    <only>INTELLIJ</only>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::NONE, KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L</autogen>
  </block>
  <block>
    <not>INTELLIJ</not>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::NONE, KeyCode::A, ModifierFlag::CONTROL_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::NONE, KeyCode::E, ModifierFlag::CONTROL_L</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, VK_SHIFT | ModifierFlag::NONE, KeyCode::A, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, VK_SHIFT | ModifierFlag::NONE, KeyCode::E, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L</autogen>
  </block>
</item>

You can see the source of the predefined settings from https://raw.github.com/tekezo/KeyRemap4MacBook/master/Tests/lib/string/data/checkbox.xml.

Lri

Posted 2013-08-22T16:42:10.387

Reputation: 34 501

Hi Lauri, I used the exact setting in KeyRemap4Macbook as u posted the screenshot of, it DOES NOT change home to cmd+left in IntelliJ. It does it elsewhere. Where is the private.xml file? I couldn't find it in IntelliJ's package contents.. – Siddhartha – 2013-08-23T00:21:54.767

1It worked for me with both the community edition and ultimate edition. private.xml is in ~/Library/Application Support/KeyRemap4MacBook/ (see the link). – Lri – 2013-08-23T02:06:08.313

That xml snippet didn't work, but I got it to work somehow else. I posted it below. Thanks for your answer! – Siddhartha – 2013-08-23T17:16:08.407

Did you include the <?xml version="1.0"?> and <root> elements, or did you enable the setting in KeyRemap4MacBook.app? – Lri – 2013-08-23T18:20:46.010

It already had:

<?xml version="1.0"?>

<root> </root> I added the snippet after it. – Siddhartha – 2013-08-23T20:27:22.937