views:

10502

answers:

15

I did a bit of googling hoping to find a post on IDEA shortcuts similar to Jeff's post on Visual Studio shortcuts (http://www.codinghorror.com/blog/archives/000315.html), but didn't really spot anything that helped. Hopefully the answers to this question will fill the void.

A: 

F7 F8 F9 for debugging

Wael Awada
+1  A: 

Any combination of ctrl+alt+shift and N.

Ctrl+Shift+T in idea8 is also excellent.

There is a complete keymap in the online help too.

krosenvold
The "N" shortcuts would be (mostly) "Navigate to" actions:Navigation Ctrl + N = Go to class Ctrl + Shift + N = Go to file Ctrl + Alt + Shift + N = Go to symbolPlus, as an added bonus, one of my personal favorites: Ctrl + Alt + N = Refactor InlineCtrl + Shift + T = go to test class (or class under test, from test class)Yep; see "Help -> Default Keymap Reference".
Jeff Grigg
+4  A: 

Some of the time savers:

  1. Alt+Enter : show intention actions (like Eclipse quick fix)
  2. Ctrl+Alt+V : introduce variable (never type the left hand side of an assignment again)
  3. Ctrl+Shift+space : smart completion ( even two levels down since IntelliJ 8 )
  4. Ctrl+w : select succesively increasing code blocks. Kind of obvious but a real time saver!

The Key Promoter and Shortcut keys list plugins are really helpful for (constantly) learning new IntelliJ keyboard shortcuts.

Ruben
Key promoter: http://plugins.intellij.net/plugin/?id=1003
Jeff Grigg
Shortcut Keys List: http://plugins.intellij.net/plugin/?id=2391
Jeff Grigg
+6  A: 

Help\Productivity Guide

It tells you what are the shortcuts you use/don't use and displays usage statistics. It will guide you to the unknown features.

+26  A: 

These are some of my most used keyboard short cuts

Syntax aware selection in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc.: Ctrl+W

Basic Code Completion, to complete methods, keywords etc.: Ctrl+Space

Go to Declaration. Use this to navigate to the declaration of a class, method or variable used somewhere in the code: Ctrl+B

Introduce Variable Refactoring, to create a variable from an expression. This expression may even be incomplete or contain errors. Since version 8, IDEA intelligently selects a likely expression when no text is selected: Ctrl+Alt+V

Go to Class, to quickly open any class in the editor: Ctrl+N

To open any file, not just classes: Ctrl+Shift+N

Comment/Uncomment current line or selection: Ctrl+/ and Ctrl+Shift+/

Quick JavaDoc Popup to show the JavaDoc of the method or class at the text cursor: Ctrl+Q (Ctrl+J on Mac OS X)

Smart Type Completion to complete an expression with a method call or variable with a type suitable in the current Context: Ctrl+Shift+Space

Rename refactoring to rename any identifier. Can look in comments, text files and across different languages too: Shift+F6

Select in Popup to quickly select the currently edited element (class, file, method or field) in any view (Project View, Structure View or other): Alt+F1

Highlight Usages in File. Position the text cursor on any identifier without selecting any text and it will show all places in the file where that variable, method etc. is used. Use it on a throws, try or catch keyword to show all places where the exception is thrown. Use it on the implements keyword to highlight the methods of the implemented interface: Ctrl+Shift+F7

Bas Leijdekkers
A: 

http://www.jetbrains.com/idea/docs/ReferenceCard70_mac.pdf has everything you need. after a while, you'll develop your own preference for certain shortcuts.

A: 

Ctrl-N. Open class.

Alt-F7. Find usages.

badbadboy
+16  A: 

By far my favourite all purpose shortcut is Ctrl+Shift+A

It does a search as you type through all the commands in intellij. Not only that but when you find the command you want it also displays the corresponding shortcut key next to it!

montyontherun
Great one! Suddenly I have a command line interface into IntelliJ!
Arne Evertsson
Great suggestion! Just found out what I was looking for. Shortcut for Parameter Info (Ctrl + P)!
Faraz
+1  A: 

Try using the Key Promoter plugin. That will help in learning the shortcuts. Couple of shortcuts apart from the above suggestions:

  • Alt+Ins: Works consistently to insert anything. (Add a new class, method etc)
  • Ctrl+Alt+T: Surround code block. Another useful stuff.
+9  A: 
Olaf
Darn: Where can I get one of these shirts?!? ;->(...and one or several for each of my team members! ;-)
Jeff Grigg
It's from Jetbrains - they brought these to Devoxx
Olaf
+3  A: 

Within the tool: "Help -> Default Keymap Reference" (as suggested by krosenvold)

On the Internet: "IntelliJ IDEA Developers Documentation"

Windows, Linux and Mac keyboard shortcut reference cards for versions 8, 7, 6, 5, and 4.5.

(I knew I had seen and used these reference "cards" before! ;-)

One of my favorites (not shown on the JetBrains cards) is "Ctrl+Shift+{Up or Down Arrow}" to move lines/methods up and down in the source code.

See also "Intellij Idea Keyboard Shortcuts" page on Ward's Wiki.

Jeff Grigg
+1  A: 

This link has everything you need. Plus in Idea 8 atleast, every shortcut is completely customizable, so it's really up to you what the most useful ones are.

Idea 8 reference PDF

Mike Pone
+2  A: 

This is probably dependent on your development environment, but when doing BlackBerry development I code in IntelliJ and still compile and debug through the BlackBerry JDE. Ctrl+Shift+C is vital in this case as it allows you to copy the full path of the file you are currently editing, making it easy to open the file in the separate dev environment.

Fostah
Very useful. Thanks :)
volothamp
+12  A: 

Here are the Intellij IDEA keyboard shortcuts I find most useful (listed in roughly the order of usage for me):

The shortcut I use the most is ctrl + B (Go to declaration), to see what a method does, where a variable is declared etc. This is almost always followed by ctrl + alt + leftArrow to get back to where I was (ctrl + alt + rightArrow works to “go forward” again).

A related navigation shortcut is ctrl + alt + B, (Go to implementation). Press it when the caret is at the method name of an interface, and you get a pop-up list of all the places where this method is implemented, and you can select which one you want to go to (if there is only one implementation, you go straight there). The same goes for overridden methods.

The opposite of this is ctrl + U (Go to super-method/super-class). If the caret is at the implementation of a method in an interface (indicated by the little green interface-symbol in the left gutter), this shortcut takes you to the interface itself.

When I want to see all the places where a method or variable is used (which I want to do a lot), I use ctrl + alt + F7 (Show usages). This gives you a pop-up list of all the usages, and you can easily navigate to each one. I prefer this over alt + F7 (Find usages), which gives you the same information, but in a separate pane below.

To find classes, I use ctrl + N (Go to class), which lets you search using only the capital letters in the class name (“camel humps”), and * as wildcard.

Yet another shortcut I use, both when reading and writing code, is ctrl + P (Parameter info) at the arguments of methods and constructors, to see the types and names of the parameters.

When it comes to writing code, I use ctrl + space (Basic code completion) a lot to auto-complete method names, variable names etc (or simply to see which methods are available for a certain object, by trying to auto-complete directly at the dot following the name of the object).

For searching in the current file I use ctrl-F (Find - probably the least surprising shortcut in this list), F3/shift + F3 (Find next/previous) to repeat the search, and ctrl + shift + F (Find in path) to search in the whole project.

Ctrl + W (Select successively increasing code blocks) is handy when selecting chunks of code. Repeatedly pressing it selects more and more of the code. Useful when searching, indenting, commenting out code etc.

If there are errors in the file, F2/shift + F2 (Next/previous highlighted error) will jump to them.

I use the sequence alt + C, N (Show Changes View) to see which files in the project I have modified compared to the subversion repository. To diff the current file against the version in the subversion repository, I use the sequence alt + C, S, Y (Compare with the Same Repository Version). In the diff view, I use F7/shift + F7 to navigate between the changes.

When not in the diff view, I use ctrl + shift + alt + upArrow/ctrl + shift + alt + downArrow to jump to the parts of the file that have been changed compared to the checked-out version. At each modification point, you see the corresponding part in the checked-out version in a pop-up window.

Finally, I run JUnit tests using ctrl + shift + F10.

Henrik Warne
+1  A: 

Ctrl+Shift+Enter - automatically completes the code statement you are typing, inserting the quotation marks, brackets, curly braces and other punctuation as necessary.

Bogdan