How to navigate to the last cursor position in Eclipse?

余生颓废 提交于 2019-11-30 06:14:47

问题


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?


回答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:




回答2:


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




回答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?




回答4:


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



来源:https://stackoverflow.com/questions/12313308/how-to-navigate-to-the-last-cursor-position-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!