How to navigate to the last cursor position in Eclipse?

Recently, I switched from Visual Studio to Eclipse. Now I am missing the shortcut for navigating to the last cursor position in Eclipse. In Visual Studio, the same can be done with the help of the Ctrl + - shortcut.

How do I do this in Eclipse?


Solution 1:

Go to Preferences / General / Keys. You'll be able to see or edit the bindings for:

  • Backward History: default is Alt
  • Forward History: default is Alt

You may also use those shortcuts (and see the key bindings) in the toolbar:

Enter image description here

Solution 2:

There is Altleft arrow and Altright arrow to navigate to previous/next cursor positions, and CtrlQ to go to the last edited position.

Solution 3:

I'm adding an answer, because I'm not allowed to comment yet. Though the dystroy's answer contains information about useful shortcuts, I'm not satisfied with it, because the mentioned Alt+left shortcut doesn't always navigate to the last cursor position (e.g. in the same file). I'm not sure how it works in Visual Studio, but in IntelliJ a similar shortcut always moved the cursor to the last cursor position, even in the same file. I would like to have such functionality also in Eclipse. For example: I move the cursor using the keyboard's down arrow key successively on lines 10, 20, 30. Now I am on line 30 and when I press Alt+left I would like the cursor to go to the line 20. After pressing Alt+left again I would like the cursor to go to line 10.

In Eclipse, when the cursor was in file A and I opened file B and moved the cursor down a few lines in file B, then Alt+left will move the cursor to the file A, instead of moving it to a previous cursor position in file B.

I created a separate question for this problem: How to navigate to the last cursor position in Eclipse if it is in the same file and was not edited?

Solution 4:

In Mac (OSX), the commands are ⌘[ and ⌘]. They are very convenient navigation commands when coding.