10/08/2012

My Intellij Notes

To search by keywords for a command, setting, shortcut, etc, and execute it:
Command + Shift + A

To maximize or full screen (useful when reading long lines).  You can also use the same shortcut to go full screen in FireFox, Safari, Chrome, Preview, iTunes, etc.
Command + Ctrl + F

To see javadoc for the method in focus:
Ctrl + J

To see which method/class the current line is in (with super long method body):
Ctrl + Shift + Q

To paste from clipboard history (including copied content from external apps):
Command + Shift + V

To copy the file path of a class:
Command + Shift + C, while inside the editor of that class, not even need to highlight the class name.

To copy the fully qualified name of a class (FQN):
Command + Alt + Shift + C

To delete a line:
Command + Y (y for yank)

To go to a line:
Command + G

To open a class:
Command + N (press it again to include non-project classes like JDK classes)

To organize imports:
Command + Alt + O

To bring up Version Control System popup (git, svn, etc):
Ctrl + V

To view all methods of the current class (press F12 again to include inherited methods):
Command + F12

To view type hierarchy (super-types, sub-types):
Ctrl + H

To jump to source file of another class:
Command + Click, or F4
Command + Shift + I, for a quick view in pop-up without openning it in editor

To go to next error/warning:
F2
Command + F1, to display the error details
Alt + Enter, to display recommended actions

To complete a statement (addthe semi-colon, going to the next line, etc):
Command + Shift + Enter

To auto-complete with text match (as opposed to code completion):
Alt + / (upward search), Alt + Shift + / (downward search)

To hide a tool window:
Shift + Escape
Command + window-number

To format the whole file:
Command + Alt + L

To format a selection:
Command + W to make a selection, then Command + Alt + L

To view and search for recent files:
Command + E, and type the first few letters to filter it in the pop-up
Command + Shift + E, for recent changed files

To switch between open files and tool windows:
Ctrl + Tab, or Ctrl + Shift + Tab, while holding Ctrl, repeatedly press Tab to change selection

To find usage of a type/class/method/variable:
Alt + F7

To generate constructor, getter, setter, toString, hashcode, equals, override method, inside editor window:
Ctrl + N
Command + O (select methods to override)
Command + I  (select methods to implement from interfaces)

To attach to a remote debugger: F9
To continue the debugger, skip all breakpoints: F9
To step over (go to next line): F8
To step into: F7
To set/unset a breakpoint: Command + F8
To view breakpoints: Command + Shift + F8

To increase indent of the current line:
Command + W, then Tab.  If pressing Tab without selection, it will just insert a tab at the cursor, which is not what you want unless the cursor is at the beginning of the line.

To decrease indent of the current line:
Shift + Tab.  No need to make a selection

To auto-format the current line:
Command + W, then Command + Alt + L.  Without a selection, it will just auto-indent the whole file

To auto-indent the current line:
Command + W, then Command + Alt + I.

To join next line into the current line:
Ctrl + Shift + J.  Useful when you need to get rid of the next few blank lines.  Command + Y will also delete a line, but you will need to move cursor to the blank line first.

To go to the beginning and end of the file:
Command + fn + Left
Command + fn + right
3 finger move on touch pad won't work

To go to the beginning and end of the screen:
Command + fn + Up
Command + fn + Down

To go to the beginning and end of the line:
Command + Left
Command + Right

To move the content up and down, while keeping the cursor in the current line:
Command + Up
Command + Down
2 fingers move on touch pad

Jump to navigation bar:
fn + Alt + Left

To add a user dictionary to customize spelling check, create a text file, one word per line, and name it choose-a-name.dic. Inside Intellij settings, search "dictionary", and add the directory containing choose-a-name.dic. Intellij will find all dictionary files (by extension .dic) in that directory.