Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to navigate to the last cursor position in Eclipse if it is in the same file and was not edited?

Tags:

eclipse

I had used Eclipse earlier, afterwards I switched to IntelliJ for a while and now back to Eclipse. There is one thing from IntelliJ which I can't find in Eclipse: Navigating to the real last cursor position - even in the same file and even if the cursor was moved between the lines using the arrow keys on the keyboard or the mouse. IntelliJ is able to do it and I found it really useful.

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.
After pressing Alt+right afterwards I would like the cursor to go to the line 20 again.

The following shortcuts are available in Eclipse:
Alt+left - it navigates back to the last cursor position in a different file, not to the last cursor position in the current file even if I already moved my cursor in the same file
Alt+right - it navigates forward to the next cursor position in a different file, not to the next cursor position in the current file even if I already moved my cursor in the same file
Ctrl+Q - moves the cursor to the last edit location

The latest version of Eclipse in which I tested the above-mentioned shortcuts: Eclipse Luna 4.4.0.

I found the following discussion about the same problem (lacking such functionality in Eclipse) which is quite old, but it seems that this functionality has not been implemented in Eclipse since that discussion in eclipse forum.

Does anyone of you know if this functionality will be implemented in Eclipse? Is there a plugin for Eclipse which provides such functionality of navigating back to the last cursor position?

Please note, that due to the reasons described above, I'm not satisfied with the solutions provided as an answer to this SO question 'How to navigate to the last cursor position in Eclipse?' or to the other SO question 'How to go back in Eclipse?'.

like image 450
krm Avatar asked Jan 31 '14 15:01

krm


People also ask

How do I go back to the previous cursor position in Eclipse?

Navigate > Back (Alt+Left_Arrow) already allows to navigate back to previous cursor positions even in the same file. E.g. after you Ctrl+Click on a reference to a local variable (to go to the declaration), then Alt+Left puts the caret back to the reference.

What is Ctrl Shift G in Eclipse?

Search – Eclipse Shortcuts CTRL SHIFT G – Search for current cursor positioned word reference in workspace. CTRL H – Java search in workspace.

What does Ctrl shift t do in Eclipse?

Switching between Open Editors Ctrl + Page Up and Ctrl + Page Down—Navigate to previous or next file from the list of open files. Ctrl + Shift + T—Display a list of classes from the workspace. Ctrl + Shift + R—Display a list of resources from the workspace.


1 Answers

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:

answered Sep 7 '12 at 8:27 Denys Séguret

like image 78
user8327014 Avatar answered Sep 29 '22 11:09

user8327014