Installation
#
sudo tar -xvf idea* -C /opt/
Run idea.sh from the bin subdirectory.
Shortcuts
#
General
#
ctrl + alt + s
- settingsctrl + shift + a
- action
Navigating
#
2 x shift
- search everywherectrl + n
- find classctrl + shift + n
- find filectrl + shift + t
- navigate between test and implementationctrl + shift + i
- object definition popupshift + ESC
- close last non center panelctrl + F12
- file structurealt + F12
- terminal
Editing
#
Execution
#
shift + F10
- run current configurationshift + F10
- execute current test class / tests for the current class
Notes from workshops:
#
alt + number
ctrl + e
- last visited placesctrl + shift + e
- last edited placesshift + escape
- closes last tool windowctrl + shift + f12
- close all tool windowsctrl + shift + arrow
- in tool window resize tool window, doesnt work in terminal (must remove capturing)ctrl + shift + a
- run actionctrl + n
- find file by class namectrl + shift + n
- find file by file namectrl + shift + alt + n
- find by symbolshift + shift
- find all abovealt + shift + F9
- debugctrl + w
- expand selectionctrl + shift + w
- reduce selectionctrl + spac
e - code completionctrl + shift + space
- smart code completion
When changing method
#
tab
- replaces current methodenter
- appends current methodctrl + shift + enter
- encloses sentence in bracketsctrl + .
- closes sentence and adds dot on the endctrl + shift + arrow (up / down)
- move properly class membersshift + enter
- add enter after current line and goes to that linectrl + enter
- add enter after current line but stays on that linectrl + d
- duplicates line or selected linectrl + y
- deletes current linealt + insert
- generatectrl + ~
- quick list
Debugger
#
shift + F7
- smart step intoctrl + alt + 9
- force run to cursoralt + F8
- evaluate expression
Bookmarks
#
F11
- toogle bookmarksshift + F11
- browse bookmarks
Scratches
#
ctrl + shift + alt
- create scratchesctrl + shift + i
- inspection
File and Code Templates
#
JUnit4 Test Class
#
import org.mockito.*;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import static org.assertj.core.api.Assertions.assertThat;;
@RunWith(MockitoJUnitRunner.class)
public class ${NAME}{
@InjectMocks
private ${CLAS_NAME} instance;
${BODY}
}
JUnit4 Test Method
#
@org.junit.Test
public void should${NAME}() throws Exception {
${BODY}
}
Code -> Reformat Code
Edit -> Macros -> Start Macro Recording
Code -> Reformat Code
Code -> Optimize imports
File -> Save all
Edit -> Macros -> Stop Macro Recording
- `Name the macro (something like “formatted save”)
File -> Settings -> Keymap -> right click on the macro ->dd Keyboard Shortcut ->et the keyboard shortcut to
ctrl + s`.