开发者

How to go back in Eclipse?

开发者 https://www.devze.com 2023-01-04 14:22 出处:网络
Is there a way to go back in Eclipse? Basically, when I\'m jumping around a big project following the execution flow (ctrl + click and etc.), is there a way to retrace a step? If my code calls a metho

Is there a way to go back in Eclipse? Basically, when I'm jumping around a big project following the execution flow (ctrl + click and etc.), is there a way to retrace a step? If my code calls a method and I go to the method definiti开发者_运维百科on, is there a key combination that will take me back to the calling code?


Press Alt+Left Arrow and Alt+Right Arrow like you would in a web browser.


On OS X:

  • + [ ( Command + [ ) : Go Back
  • + ] ( Command + ] ) : Go Forward


As Robin mentioned, you can also jump to the last edit location. Ctrl+Q is the keyboard shortcut for this!


On Windows/Ubuntu this was always

ALT+LEFT ARROW = Go back

ALT+RIGHT ARROW = Go forward

However, on MAC OSX, for me it was

ALT(Option)+COMMAND+LEFT ARROW = Go back

ALT(Option)+COMMAND+RIGHT ARROW = Go forward

Hopefully this will help other Mac people in the future who banged their head on the desk when the other answers did not work.


In addition to the keyboard shortcut mentioned by @lucas, there is the left and right arrow icons in the toolbar. It also has a handy back to last edit location as well.

Both of these are of course reflected in the menu under Navigate as well.


Keyboard bindings can change based on your OS and current Keys Scheme. So the best way to know a keyboard binding is to look up its Command in Preferences > Keys. That is also where you can change or add a keyboard binding.

Which means instead of asking for a shortcut, you should generally ask for the command (or at least ask for both). In this case the commands you want are Backward History and Forward History. You can see in the following screenshot that they are mapped to Ctrl+[ and Ctrl+] in my Key Scheme (because I changed them to that).

How to go back in Eclipse?

As mentioned by others, Last Edit Location can be a really useful command also. In my case it's mapped to Ctrl+Q, but you check it under Keys :).


These commands are very frequently used, so it is worth having all their shortcuts the same way in all your IDEs. To adjust them:

  1. Open Eclipse
  2. Windows -> Preferences -> General -> Keys
  3. Search for "Backward History" and "Forward History" and adjust the bindings.

For me personally Visual Studio's default Ctrl+- and Ctrl+= works best.


For me in Eclipse by default it is done by pressing "Left-Alt + Left-Arrow" key combination. You can also change the key combination of it in settings of eclipse which is exist with the shortcut name 'Backward-History'. I have made it "Right-Alt + Lest-Arrow" for my convenient.

I have also changed key combination for 'forward-History' as "Right-Alt + Right-Arrow".

0

精彩评论

暂无评论...
验证码 换一张
取 消