How to navigate to the last cursor position in Eclipse?

后端 未结 4 2249
感情败类
感情败类 2020-12-12 17:43

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 do

相关标签:
4条回答
  • 2020-12-12 18:31

    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?

    0 讨论(0)
  • 2020-12-12 18:33

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

    0 讨论(0)
  • 2020-12-12 18:41

    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

    0 讨论(0)
  • 2020-12-12 18:42

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

    0 讨论(0)
提交回复
热议问题