Ten Under-Appreciated Eclipse Keystrokes

Think you know Eclipse? Most programmers quickly learn the common keystrokes but don’t take advantage of other good shortcuts. Here are my favourite lesser-known ones:

1. Ctrl-F6 - Next Editor

ctrl-f6.png This handy little keystroke gives you a stack of open windows to cycle through, similar to Alt-Tab in Windows. I use it so often I’ve re-mapped it to Ctrl-Tab.

2. Ctrl-1 - Quick Fix

Ctrl-1

Okay, so you know about this one. But do you create errors on purpose so Quick Fix can do its magic? This is often faster than typing the correct code. Some examples:

  • When creating new variables, don’t declare the type - let Eclipse figure it out from the assignment expression.
  • Call a method that doesn’t exist yet and Eclipse will add it for you, complete with semi-intelligent parameter names.
  • Need to add or remove method arguments? Just change the method call and Eclipse will update the method declaration.
  • On a line with no errors, use Ctrl-1 to ‘Rename in File’, which executes much faster than Ctrl-R. (If the line has errors, you’ll have to select the element you want to rename)


3. Ctrl-T - Quick Hierachy

Ctrl-TFrom within a method press Ctrl-T to quickly navigate to a sub-class implementation or to a super-class definition.



4. Ctrl-Q - Go To Last Edit Position

Does exactly what it says on the tin. Useful when you’ve copied a bit of text and want to paste it into your last edit position. This keystroke is so good I find myself instinctively using it in editors outside Eclipse.

5. Alt-Shift-Up - Expand Selection To Enclosing Element

Ctrl-Shift-UpThis keystroke is often faster and more accurate than a mouse in selecting text.
Use Alt-Shift-Down for the reverse operation.

6. Ctrl-Space - Content Assist

Use this outside a method to add constructors, getters, setters and overridden methods to a class.

7. Alt-Up/Down - Move Line Up/Down

Move the current line or selection up or down.

8. Ctrl-Delete/Backspace - Delete Word

These are two “standard” keystrokes used in many editors and are very useful. I have to admit I only discovered them about a year ago!

9. Ctrl-D - Delete Line

Like me, many developers have discovered this one accidentally while habitually pressing Ctrl-S to save their work; “Damn! What did I press?! Hmm… actually that’s quite useful…”

10. Ctrl-M - Maximise Editor

Not used in everyday desktop programming, but indispensable on a laptop. If you use it much you’ll want to turn off the animation (Window -> Preferences -> Appearance). Even then, this feature is noticeably slower than in the good ol’ version 2.0 days.



2 Responses to “Ten Under-Appreciated Eclipse Keystrokes”

  1. Tobias Schoessler Says:

    4. Ctrl-Q - Go To Last Edit Position

    … Is my absolute favorite. But there is one thing that bugs me, when I eye enviously over to my collegues from the Netbeans camp. Why the heck is eclipse not jumping to the one before, two before, three before … the last edit position like Netbeans does when i repeatedly hit the CTRL-Q. Eclipse only remebers the last edit position. Anybody kows how to get Eclipse remeber more Edit poitions?

  2. George Petrov Says:

    Alt-Left/Right - Back/Forward (like in a web browser) - great when you’re browsing code….

Leave a Reply