IntelliJ IDEA Cheat Sheet

Keyboard shortcuts and various tips for IntelliJ IDEA. This document assumes IntelliJ on a Mac, using the Keymap setting for Mac OS X 10.5+ (in Preferences > Keymap). I know you can get all these through Help > Keymap Reference in IntelliJ, but I like to maintain my own list so that I can organize and search it the way I prefer, plus have a place to add my own additional notes.


Comment / uncomment selected text Select block of text and then press CMD + /
Spread selection from cursor (to word, then line, etc.) ALT + up arrow or down arrow
Format selected code CTRL + ALT + I
Format all code ALT + CMD + L
Autocomplete method parameter info CMD + P (when cursor is in method signature)
Invoke a Surround Template (ex: surround a line with try/catch) OPTION + CMD + T
Complete a statement SHIFT + CMD + ENTER
Import Java Package Hover over the red text of the class missing a package and press: ALT + ENTER

Live Templates

Live templates can be found in Preferences > Editor > Live Templates. Learn them! To use a live template, enter its short text in the editor and then press tab to replace the short text with its template.


Tool Windows and Dialogs

Project CMD + 1
Version Control CMD + 9
Preferences CMD + ,
Breakpoints SHIFT + COMMAND + F8
Recent Files CMD + E
Search Everywhere SHIFT + SHIFT
Search Classes CMD + O
Search Symbols OPTION + CMD + O
Navigate back and forth through recent files CMD + [ and CMD + ]
New file (where selection is in Project window) CMD + N Note: you can use slashes to create entire trees abc/def/ghi/jkl…
Hide all other windows SHIFT + CMD + F12
Stretch pane right or left SHIFT + CMD + left or right arrow
Clipboard History SHIFT + CMD + V
Method List (of the active editor file) CMD + F12
Navigation Bar CMD + up arrow Note: This is particularly useful if you turn off the normal navigation bar in preferences to save UI space.
Action Search SHIFT + CMD + A (try, for example, “RESTful Web Service”)
Version Control Quick List CTRL + V
Quick Switch Settings CTRL + ~
Quick Documentation CTRL + J (and then again to pin it open at larger size).

TO DO items

Create a TO DO item

  • CMD + / to create a new comment line
  • Type TODO then whatever comment you want

View all TO DO items

  • View > Tool Windows > TODO or
  • CMD + 6

Increase IntelliJ IDE memory on a Mac

  • Help > Edit Custom VM Options…
  • Answer Yes to create the idea.vmoptions file. This will automatically create a copy of the .vmoptions file in the config folder and open a dialog to edit it.
  • I change -Xmx750m to -Xmx2048m


Following are some of the Tip of the Day items that appear when you first open IntelliJ.

Highlight usages of some variable
  • Use ⇧⌘F7 (Edit | Find | Highlight Usages in File) to quickly highlight usages of some variable in the current file.
  • Use ⌘G and ⇧⌘G keys to navigate through highlighted usages.
  • Press ⎋ to remove highlighting.
Optimize imports
  • Use Code | Optimize Imports to automatically optimize imports (remove unused imports, etc.). To access the corresponding settings, use File | Settings | Code Style | Imports.
Reformat code
  • Use Code | Reformat Code to reformat code according to your code style preferences (File | Settings | Code Style).