Timesavers: Common Eclipse Shortcuts

Friday, April 17, 2009

This is part of an ongoing series on Timesavers . The goal is simple: short, easily-digestible posts designed to help developers get faster and more productive
This TimeSaver is dedicated to common keyboard shortcuts that everyone should know. Well, let me back off of that. If you like being slower than a 3-toed Sloth, that's your prerogative. If you want to be fast, put the mouse down and use these shortcuts.
  • Ctrl-S to Save
  • Ctrl-Shift-S to Save All
  • Ctrl-W to close the current document
  • Ctrl-Shift-W to close all current documents
  • Ctrl-N to pop up the "New..." dialog. Please, when you're creating new files, don't use the mouse. In your navigator or package explorer, put your mouse where you want your new file, and hit "Ctrl-N", then filter on the type of file or project or whatever you want to create, and hit Enter.
  • Ctrl-M to maximize (and minimize) the current active window. This works for editors and views.
  • Ctrl-F to find stuff within your active editor
  • Ctrl-K and Ctrl-Shift-K to do "find next". I love these things! You highlight a word in your file, then hit ctrl-k to find other instances of it, one at a time. Go ahead, try it. use Ctrl-Shift-K to find backwards
  • Ctrl-H to find stuff in other files in your workspace.
  • Ctrl-Space to pop up content assist (aka tag/function insight). This one bears some elaboration for us CFMLers. You know how when you type a function name, say reFind(, and it pops up the content assist? but then when it disappears you don't know how to get it back up again? Just hit Ctrl-Space. Go ahead, try it. Go find a function in your code, put your cursor after the paren, and hit Ctrl-Space. For the energetic, read my long diatribe with a mini-section on what I call "Ctrl-Space-Learn".
  • Alt-Up and Alt-Down to move a whole "selection" (a line, or a chunk of lines) up or down
  • Tab to indent, Shift-Tab to de-indent
  • Ctrl-Shift-L to pop up a box showing other keyboard shortcuts

How do you get the swing of these?

I started by keeping a printout on my desk. It was a start. But the real key for me was to try to develop a palpable aversion to the mouse. For example, if I found myself mousing to create a new file, even if I were almost finished. I'd cancel it and do it with the keyboard. I'd do the same thing for all the other operations above. I try to nurture good developer habits; becoming keyboard-addicted is one worth developing yourself.


Anuj Gakhar said...

I would also recommend ctrl+e and ctrl+shift+r - 2 really useful shortcuts.

Marc Esher said...

Definitely, Anuj! Know that I've cordoned those beauties off for the next Timesaver post, dedicated to all-things-resource-related.

Bradley Moore said...

I'm a fan of ctrl+shift+r and ctrl+alt+( up or down ).

Mike said...

The worst thing about the shortcuts is that they are not exactly the same between windows and mac. Personally, I think the mac has too many modifier keys. Fn, Ctrl, alt, option, cloverleaf (apple thingy formally known as the "place of interest" sign)

Jamie Krug said...

The de-indent has always been Shift-Tab for me (not Alt-Tab, which of course changes windows in all major OS distros that I know of).

It's also worth noting that these indent/de-indent shortcuts work for not only a single line, but a block of code -- something a lot of CFEclipse newbies may miss (I don't think this was readily available back in the HomeSite days:).

I'm a big fan of time savers, in general -- something a lot of developers overlook (often resistence to change, I think?). So thanks for sharing a great series of posts!

Marc Esher said...

Jamie, thanks for pointing out my goof on shift-tab. Fixed!

Dan G. Switzer, II said...

I put together this list of shortcuts a while back, so this might be a nice companion list to yours:


I need to add the [CTRL]+[M] to my list--that's a handy one.

Marc Esher said...

dan, that's a mighty fine list. I did not know about Ctrl-3... very cool! ctrl-alt-right/left is cool too. I'm gonna have to study your list and build these habits.

thanks for sharing.

Daniel said...

Ctrl + D to delete a line

Ctrl+Atl+up or down, to copy a line

Marc Esher said...

Thanks Dan. How'd I leave ctrl-D out of there? He's a good friend of mine.

luigi.agosti said...

this is a good list of eclipse shortcut


javarevisited said...

here is my list of useful eclipse shortcut I would rather say very useful and practical eclipse shortcut :)

Javin Paul
FIX Protocol tutorial