Often you want to scroll the editor pane up or down to read code. If you don’t need to edit the code, you might not need to move your cursor from its current location. Use Ctrl+Up or Ctrl+Down (or ⌘Up/ ⌘Down) in your editor pane to scroll it without changing the cursor position.
Use live templates to insert common constructs into your code, such as loops, conditions, various declarations, or print statements.
To expand a code snippet, type the corresponding template abbreviation and press Tab.
- Ctrl + J: List of live templates available in the current context.
Postfix code completion lets you add template code around an expression you’ve just typed.
A template expands when you type its abbreviation (postfix) after a dot and press the expansion key
(Tab by default) or when you select the abbreviation in the code completion popup.
For example, the .if
postfix applied to an expression wraps it with an if statement.
To see a full list of postfix abbreviations for your code, type "." (dot) and press the "up" arrow on the dropdown list of suggestions.
- Ctrl + F12: Help you get around IntelliJ and files in record time.
- Ctrl + B: A keyboard shortcut for getting to where a method or variable is declared.
- Ctrl + G: Go to line.
- Ctrl + N: Navigate to class. It is possible to use Camel humps(you can type only initial letters of camel case names, and IntelliJ will find items with matching names automatically).
- Ctrl + Shift + N: Navigate to file. It is possible to filter files by format. It is possible to open packages.
- Ctrl + Shift + A: Actions.
- Alt + Shift + Left/Right: Move back/forward to what you have been working on.
- Ctrl + E: Recent files.
- Ctrl + Shift + E: Recent locations.
- Double Shift: Search everywhere. Use Ctrl + Up/Down to move between blocks.
- Ctrl + Shift + F12: Hide/Restore windows.
- Alt + Mnemonic: A mnemonic is an alphanumeric character, which indicates the key to press to activate a command or navigate to a component.
- Ctrl + Shift + I: Quick view. If you’re reading a test you’ve written, and you want to quickly view the definition of a method, just place the cursor on the method name and press this shortcut.This way you don’t have to navigate to another class to read the code you’re interested in.
- Ctrl + W: Extend selection. To reverse the operation use Ctrl + Shift + W.
- Ctrl + Space: Basic completion.
- Ctrl + Shift + Space: Smart completion.
- Ctrl + Shift + Enter: Statement completion.
- F2: Move to a first error in the code.
- Ctrl + Left/Right: Move between words.
- Ctrl + Alt + O: Clean the unused imports.
- Ctrl + Alt + V: Extract the variable.
- Ctrl + Alt + C: Extract the constant.
- Ctrl + Alt + M: Extract the method.
- Ctrl + Alt + P: Extract to parameter.
- Ctrl + Alt + F: Extract to field.
- Alt + Shift + Up/Down: Move the line.
- Ctrl + Shift + Up/Down: Move the expression.
- Ctrl + Alt + L: Reformat code.
- Ctrl + Alt + Shift + L: Reformat code with dialog.
- Ctrl + Shift + T: Go to test.
- Ctrl + Shift + F10: Run current context.
- Shift + F10: Run the currently selected run configuration.
- Ctrl + Alt + Shift + P: Extract to functional interface.
- Ctrl + F6: Change the signature of the method.
- Ctrl + Alt + Shift + T: Refactor this dialog.
- Ctrl + Shift + Backspace: Jump back to previous edit.
- Alt + Shift + F8: Evaluate expression.
- Ctrl + F8: Insert the breakpoint.
- Alt + Insert: Insert files.