Shortcuts anyone??
by Abhijeet Kashnia
"Which IDE do you use?" Eclipse
"So, can you program without a mouse?" This question from a veteran programmer set me thinking whether I was making the best use of my IDE... I was not. So, I was advised to unplug my mouse and get going without it, an old school approach.
After a couple of weeks of using Eclipse mostly from the keyboard (No, I didn't throw the mouse away), here's my list of favourites:
Ctrl+F6, Ctrl+F7, Ctrl+F8 : to manoeuvre the different windows, views and perspectives.
Ctrl+1, Ctrl+2 : to provide context sensitive help, could be promoting a variable to the instance level, creating a new class, and a whole lot of other things. This one's indispensable. I expect this to be even more useful when driving code the TDD way.
Ctrl+T: to see the type hierarchy. Very handy when traversing code that has interfaces and abstract classes.
Alt+Shift+R: Renames, one of the refactoring menu options.
Alt+BackArrow, Alt+ForwardArrow: the last location where we edited.
Ctrl+ PageUp, Ctrl+PageDown: Tab through the open code windows.
Ctrl+E: helps select and open files when traversing the open files in the editor.
Alt+Shift+N: to show the menu that lets you create anything new, be it a project, package or class.
Ctrl+Shift+O: organize imports.
Some of the less important shortcuts are:
Alt+Enter: for the project properties. Handy when you want to, say change the jar files that eclipse puts on the class path for a project.
Ctrl+Shift+R: opening a resource, but I don't use this too often, I prefer Ctrl+E.
Ctrl+W: closes a editor file. This works in web browsers (like chrome and firefox) as well, where it closes a tab.
I took this a step further, could I browse without a mouse?
Press F7, and step into the caret browsing mode. Then you can browse the web in the text mode. To open a hyperlink in a separate tab, use Ctrl+Enter. This works at least for firefox.
Its amazing the time these shortcuts save. But more important is the fact that they let you think about the problem at hand, you think about the code in the file and not about how to get to it.