Friday, 23 March 2012

Eclipse shortcuts

There are some ridiculously useful Eclipse shortcuts that I only recently learned. With editors I tend to be on the side of not bothering to learn one too thoroughly because I soon end up using something else anyways. For the past year or so I have almost exclusively used Eclipse so I guess I'm getting stuck with it. Even Code Composer Studio, which is my main editor at work nowadays, is based on Eclipse these days.

So I stumbled upon some shortcuts recently and ended up going through the full list of defined ones. I even made a cheat sheet and taped it on the bottom of my screen. Here's a few examples:

Alt + up or down: History. You can easily jump between points you have been to with this.
Ctrl+Q: Last edit. Moves you to the place where you last made edits.
Ctrl+Shift+up or down: Go to next or previous member. Really neat way of going through the functions.
Shift+Alt+up: Select enclosing element. Quick way to select blocks of code.
Ctrl+/: Comment and uncomment selection.
Ctrl+I: Correct indentation. Very, very handy when you move code around or copy-paste it from somewhere else.
Ctrl+J: Incremental search.
Ctrl+1: Quick fix. When Eclipse detects there is an issue on a line you go to that line and press this and Eclipse will suggest how to fix it.
Ctrl+Shift+N: Add include. You have a missing include? If Eclipse knows where it is, it will automatically add it with this shortcut. No more searching for the correct header!
Ctrl+=: Explore macro expansion. Shows the statement with macro definitions "opened".
Alt+up or down: Move selection up or down. More convenient than ctrl+x && ctrl+v.

And last but not least:
Ctrl+Shift+L: Show shortcuts.

I'm still to try Ctrl+Shift+F which formats selected code because it needs some setting up. But I already like the idea...

No comments:

Post a Comment