Get Better At: IntelliJ IDEA

IntelliJ IDEA is a wonderful piece of software.

And that’s all I’m going to say; I won’t run comparisons against other popular IDEs, because that’s a subject for another day. Today, I want to talk about sharpening your skills with IDEA.

Shortcuts

We all know that shortcuts improve our productivity. Here are the ones I find most valuable:

  • CTRL-W and CTRL-SHIFT-W: Select progressively greater / lesser levels of code
  • CTRL-ALT-V: Introduce Variable. See also Introduce Field / Constant
  • type “iter” TAB: Java 5 style for loop Live Template. See sections below for more info on this
  • ALT-LEFT and ALT-RIGHT: View previous / next tab.
  • CTRL-ALT-LEFT and CTRL-ALT-RIGHT: Back / Forward Tab (in history).
  • CTRL-N and CTRL-SHIFT-N: Find Class and Find File.
  • ALT-F12: Show class outline (press again to also show Inherited members).
  • CTRL-D: Duplicate Line.
  • F2 and SHIFT-F2: Go to next / previous error (or warning).
  • ALT-INSERT: Create new file popup.
  • CTRL-SHIFT-F: Find in path.
  • CTRL-ALT-T: Show list of Live Templates.
  • ALT-ENTER: Show Intentions (see below for more info)

Live Templates

Live Templates are snippets of code you can insert in and around pieces of code. The most common one would probably be “Surround with If”, which takes the highlighted code and surrounds it with an If statement. What’s more, it formats the code correctly so you needn’t worry about tab spacing.

Another good Live Template is the for loop generator. Type “iter” and then hit TAB. IDEA intelligently selects a list of collections you might wish to iterate over:

To create you’re own templates, I would recommend you take a look at this Jetbrains blog post describing how to create a null-check template.

Quick Lists
You can create a shortcut to open a popup of commonly used items of your choosing. Within Preferences, go to Quick Lists to define a new list, and then Key Intentions to create a shortcut for that list. As an example:

Intentions
Intentions can be used to perform common actions, or solve problems with your code. Hitting ALT-ENTER over a valid piece of code will give you common actions. Doing the same over an error will give some suggestions such as:

  • Migrate Type
  • Cast expression
  • Import unknown symbol

Below is an example of both forms of intention:

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Slashdot
  • Twitter

Tags: , ,

4 Responses to “Get Better At: IntelliJ IDEA”

  1. Misty Coco says:

    You should participate in a contest for probably the greatest blogs on the web. I’ll suggest this website!

  2. actor says:

    I’m having some problems with Firefox, so I want to uninstall it and then reinstall it. But I want to save all my bookmarks, so can I save my bookmarks to my computer, and then import them back to Firefox once I reinstall it? Thanks for the help..

  3. Well I really liked studying it. This article provided by you is very effective for good planning.

  4. I want to express some appreciation to the writer for rescuing me from such a challenge. Because of looking throughout the world wide web and obtaining things which are not productive, I assumed my life was done. Existing minus the answers to the problems you have fixed as a result of your good article content is a crucial case, and ones that would have adversely damaged my career if I hadn’t encountered the website. Your expertise and kindness in controlling all things was tremendous. I’m not sure what I would’ve done if I hadn’t come upon such a subject like this. I’m able to at this moment look ahead to my future. Thanks so much for your specialized and sensible guide. I won’t hesitate to propose your web site to anybody who desires counselling about this issue.

Leave a Reply