tags:

views:

80

answers:

1

simple eclipse question: is there a way i can make the 'down' key move to the end of the line (like the 'end' key binding) IF im editing the last line of the file (so it continues to behave like before, if its not the last line of the file)?

pretty much like visual studio works, move up and down lines if its not the last line, but acts like 'end' if its the last line. thanks.

+1  A: 

Not with the eclipse as it is currently distributed: a command like "Line Down", associated to the key, will always move down the lines, not jump at the end of one.

You would need to define your own keyboard shortcut, like the one describe in this Eclipse wiki entry, associated to your own key-binding configuration. It would be similar to:

   <extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="org.eclipse.ui.examples.contributions.view.edit"
            contextId="org.eclipse.ui.examples.contributions.view.context"
            sequence="ARROW_DOWN"
            schemeId="org.eclipse.ui.examples.contributions.scheme">
      </key>
   </extension>

See also the help page.

then you would run your patched version of eclipse, with the relevant action taken when ARROW_DOWN is pressed.

VonC
Surely this would do it every time, not just on the last line?
Benj
@Benj: the idea is to *program* what ARROW_DOWN will do when pressed: i.e. go down one line if it is not the last line, go the end of the line if it is. My point is: there is no default action which does that: you need to code it and associate it with a command, itself associated in the key commandId attribute.
VonC