IntelliJ IDEA Cheatsheet - Java IDE Shortcut Reference

IntelliJ is powerful enough to be slow to learn; the shortcuts are the unlock. This reference groups navigation, editing/refactoring, generation/completion, run/debug stepping, VCS and layout. It flags high-yield keys like Search Everything, Generate, and Rename across the hierarchy, plus the debugger stepping set. For Java/Kotlin work where jumping between related classes and runtime state is constant. After reading you navigate, refactor and debug without breaking to the mouse.

Dev Tools·55 commands·Last updated 2026-07-21
intellijideajavaShortcuts

Typical Use Case

For engineers doing JVM or multi-language development in IntelliJ IDEA, with macOS keys. Six areas cover the main flow: navigation, editing and refactoring, completion, running and debugging, version control, and window management. Three habits are worth building first — Shift+Shift as the universal entry point when you do not know where something lives, Cmd+B and Cmd+Alt+B to jump between declaration and implementation when reading unfamiliar code, and Cmd+Alt+L plus Cmd+Alt+O as the fixed routine before committing. Alt+Enter resolves warnings in place, and Shift+F6 is far safer than find and replace for renames. Debug with F8 to step over, F7 to step in, Shift+F8 to step out.

Editing & Refactoring 13

Cmd+D
Duplicate current line
Cmd+Y
Delete current line
Cmd+/
Line comment
Cmd+Alt+/
Block comment
Cmd+Alt+L
Reformat code
Cmd+Alt+O
Optimize imports
Shift+F6
Rename
Cmd+Alt+V
Extract variable
Cmd+Alt+M
Extract method
Cmd+Alt+C
Extract constant
Cmd+Alt+F
Extract field
Cmd+Alt+N
Inline
Alt+Enter
Quick fix / suggestion

Code Completion 7

Ctrl+Space
Basic completion
Ctrl+Shift+Space
Smart completion
Cmd+P
Parameter info
Cmd+Q
Quick documentation
F4
View source
Alt+J
Select next occurrence
Cmd+Alt+T
Surround with template

Run & Debug 10

Ctrl+R
Run current configuration
Ctrl+D
Debug current configuration
Ctrl+Shift+R
Run current file
Ctrl+Shift+D
Debug current file
F8
Step over
F7
Step into
Shift+F8
Step out
Alt+F9
Run to cursor
Cmd+F8
Toggle breakpoint
Cmd+Shift+F8
View all breakpoints

Version Control 6

Cmd+K
Commit
Cmd+T
Pull
Cmd+Shift+K
Push
Alt+`
VCS operations popup
Cmd+9
Open Git tool window
Alt+3
Open Find tool window

Window Management 8

Cmd+1
Open Project tool window
Cmd+4
Open Run tool window
Cmd+5
Open Debug tool window
Cmd+7
Open Structure tool window
Cmd+Shift+F12
Maximize editor
Cmd+,
Open Settings
Cmd+;
Open Project Structure
Shift+Shift
Search Everywhere

Parameter matrix

ParameterEffectExample
Shift+ShiftSearch Everywhere, global search across classes/files/symbols/actionsShift+Shift
Cmd+OGo to classCmd + O
Cmd+Shift+OGo to fileCmd + Shift + O
Cmd+Alt+LGo to symbol (method/variable)Cmd + Alt + L
Cmd+BGo to declarationCmd + B
Cmd+Alt+BGo to implementationCmd + Alt + B
Cmd+UGo to superclass/interfaceCmd + U
Alt+F7Find usages (list all call sites)Alt + F7
Cmd+[ / Cmd+]Navigate back to previous position / forward to next positionCmd + [
F2 / Shift+F2Jump to next / previous compile errorF2
Cmd+DDuplicate current lineCmd + D
Cmd+YDelete current lineCmd + Y
Cmd+/ / Cmd+Alt+/Toggle line comment / block commentCmd + /
Cmd+Alt+LReformat codeCmd + Alt + L
Cmd+Alt+OOptimize importsCmd + Alt + O
Shift+F6Rename and auto-update referencesShift + F6
Cmd+Alt+VExtract variableCmd + Alt + V
Cmd+Alt+MExtract methodCmd + Alt + M
Cmd+Alt+CExtract constantCmd + Alt + C
Cmd+Alt+FExtract fieldCmd + Alt + F
Cmd+Alt+NInlineCmd + Alt + N
Cmd+Alt+TWrap with template (if/for/try)Cmd + Alt + T
Alt+EnterQuick fix / suggestion (catch-all)Alt + Enter
Ctrl+SpaceBasic code completionCtrl + Space
Ctrl+Shift+SpaceSmart completion (completes chained calls)Ctrl + Shift + Space
Cmd+PView parameter infoCmd + P
Cmd+QQuick documentationCmd + Q
F4View sourceF4
Alt+JSelect next occurrenceAlt + J
Ctrl+RRun current configurationCtrl + R
Ctrl+DDebug current configurationCtrl + D
Ctrl+Shift+RRun current fileCtrl + Shift + R
Ctrl+Shift+DDebug current fileCtrl + Shift + D
F8 / F7 / Shift+F8Step over / step into / step outF8
Alt+F9Run to cursorAlt + F9
Cmd+F8 / Cmd+Shift+F8Toggle breakpoint / view all breakpointsCmd + F8
Cmd+KCommitCmd + K
Cmd+TPullCmd + T
Cmd+Shift+KPushCmd + Shift + K
Alt+`VCS operations popupAlt + `
Cmd+9Open Git tool windowCmd + 9
Cmd+1 / 4 / 5 / 7Open Project / Run / Debug / Structure panelsCmd + 1
Cmd+Shift+F12Maximize editorCmd + Shift + F12
Cmd+,Open settingsCmd + ,
Cmd+;Open project structureCmd + ;

Common pitfalls

SymptomAfter formatting, the code produces a large unrelated diff against teammates' versions.

CauseThe Code Style config differs from the team's; formatting reorders indentation, line breaks, or quotes per each side's own rules.

FixFirst set Code Style to the team convention in settings and commit the config file to the repo; run Cmd+Alt+L consistently before committing.

SymptomAfter renaming, some places still reference the old name and compilation fails with cannot find symbol.

CauseOccurrences in string constants, XML, or reflection config are not covered by the IDE's reference index.

FixShift+F6 lists all references it recognizes for you to confirm one by one; for the remaining scattered spots use Cmd+Shift+F to search the old name globally and fix them.

SymptomCmd shortcuts do nothing in the Windows version of the IDE.

CauseThis sheet is based on macOS keybindings; the Windows equivalents differ (Ctrl / Alt combos).

FixUse Shift+Shift to search by action name; the panel shows the correct keybinding for the current OS.

SymptomWhile debugging you keep stepping into third-party libraries and never see your own business code.

CauseF7 steps into every function call, including external library implementations, so the call stack goes ever deeper.

FixBy default use F8 to step over and only F7 into calls when you need to inspect the logic; after stepping in, use Shift+F8 to return to the caller immediately.

SymptomThe Alt+Enter suggestions offer several options and picking the wrong one rewrites the code in a way you did not want.

CauseThe quick-fix list mixes different categories such as Intention, Inspection, and Refactor, and each selected item behaves differently.

FixRead the full description of the prompt before applying; for options with a wide rewriting scope, press Cmd+Z to undo and switch to a specific refactoring action instead.

SymptomExtract Variable or Extract Method reports that it cannot extract, or the logic changes after extraction.

CauseThe selection is not a single complete expression, crosses statement boundaries, or contains side effects (increment, assignment, function call), so the IDE refuses or splits it incorrectly.

FixSelect only one complete expression and add parentheses to pin down precedence when needed; split expressions with side effects into several steps before extracting.

SymptomThe file you just created is missing from the Git commit panel.

CauseNew files are untracked and must be added to the staging area first.

FixOpen the Git tool window with Cmd+9, check the Changes and Untracked groups, add the file, then run Cmd+K.

SymptomIrrelevant entries appear among the smart-completion candidates, and a wrong pick means a pile of references to redo.

CauseCtrl+Shift+Space smart completion expands long chained calls based on context, so a long candidate list is easy to mis-select.

FixFirst use Cmd+P to check the method signature and parameters, then press Enter; when unsure, fall back to basic completion with Ctrl+Space and select step by step.

Troubleshooting

  1. 1The go-to entry point when you do not know where something is

    Shift+Shift → type class / file / method / action name

    Search Everywhere searches four kinds of content: classes, files, symbols, and command actions. If a class cannot be found, it is usually because the index is not built yet or dependencies have not finished downloading; trigger a project build first and try again.

  2. 2The three-step navigation combo for reading unfamiliar code

    Cmd+B (go to declaration) → Cmd+Alt+B (go to implementation) → Alt+F7 (find usages) → Cmd+U (go to superclass)

    Jump from the interface to the implementation to see the real logic, then use Alt+F7 to list all call sites and confirm the impact scope, and Cmd+U to return to the abstraction. These four steps quickly build a global understanding of unfamiliar code.

  3. 3The fixed three steps before committing

    Cmd+Alt+L (reformat) → Cmd+Alt+O (optimize imports) → Cmd+K (commit)

    Formatting unifies the style and optimizing imports clears unused ones; after these two steps the diff contains only real logic changes. Then commit with Cmd+K for the least review noise.

  4. 4Refactor and verify before committing

    Shift+F6 (rename) → Cmd+Alt+V (extract variable) → Cmd+Alt+M (extract method) → Cmd+Alt+N (inline)

    Confirm the reference list one by one when renaming; extraction separates long expressions and duplicated logic for better readability; inline removes intermediate variables used only once. After running the sequence the diff is structural and does not change behavior.

  5. 5Standard debugging workflow

    Ctrl+D (debug) → Cmd+F8 (toggle breakpoint) → F8 / F7 / Shift+F8 → Alt+F9 (run to cursor)

    F8 steps over one line in the current function, F7 steps into a function, and Shift+F8 returns to the caller; Alt+F9 suits cases where you only want to run up to the line before the failure. Use Cmd+Shift+F8 to check whether breakpoints land on the actual execution path.

  6. 6Quick jumps for compile errors

    F2 (next error) → Shift+F2 (previous error) → Alt+Enter (fix in place)

    F2 jumps through the build error list one by one, faster than scrolling the console manually; once at the error line press Alt+Enter to see available fixes (such as generating a missing method or adding an import), and anything auto-fixable need not be edited by hand.

  7. 7View the call chain and quick documentation

    Cmd+P (parameter info) → Cmd+Q (quick documentation) → F4 (view source)

    Hover over a method name and use Cmd+P for the full parameter list and Cmd+Q for the docs; for JDK or third-party classes press F4 to jump straight to the source to confirm the implementation, the most reliable way to determine behavior.

Command Examples

Locate first with Search Everywhere, then jump to the definition

Shift+Shift (type class name) Cmd+O (type class name) Cmd+B

Browsing a thousand-file repo by tree almost never hits. Search Everywhere is index-backed, Cmd+O targets a class exactly, and Cmd+B opens its definition — the fastest way to orient yourself in unfamiliar code.

Confirm every call site before renaming a signature

Cmd+B (go to declaration) Alt+F7 (find usages) Shift+F6

Shift+F6 renames semantically, including string references and tests. But if the target class comes from a jar without attached sources, only in-project call sites get updated and external callers are silently missed. Always re-check with Alt+F7 afterwards.

Run to cursor instead of stepping line by line

Cmd+F8 (toggle breakpoint) Alt+F9 (run to cursor) F7 (step into) F8 (step over) Shift+F8 (step out)

Stepping through a loop with F8 is a trap. Break outside the loop, Alt+F9 straight to the cursor, and only use F7/F8 when one specific line is suspect; Shift+F8 pops back out.

Find the conflicting keymap instead of hammering the shortcut

Cmd+, (search Keymap in settings) Search the target action → right-click to see if it is already bound If it conflicts choose Add Keyboard Shortcut or Remove

A shortcut that suddenly stops working usually means two keymaps (your custom one or a Vim/Emacs plugin) collided. Search the action in Keymap settings, inspect all bound combos on the right, then unbind or rebind via the context menu. If the action seems missing, first confirm you are actually in the keymap you think you are.

Rolling back a bad settings change

Cmd+, (Settings) Search Version Control → Local History Right-click Settings.xml or the target file → Revert

IDEA settings have no undo button. After breaking a keymap, plugin, or index setting, recover the file version through Local History. Whether .idea/ is also recoverable via git depends entirely on your .gitignore — a separate rollback path.

Common Pitfalls

  • Shift+F6 also rewrites string literals, reflection names, and config keys. Renaming a public interface breaks every compiled caller unless you keep a deprecated alias.
  • Editing code during a debug session and re-running without rebuilding executes the old class — when a fix "does not take effect", check the build artifact first.
  • Alt+F9 (Run to Cursor) only applies to the current session; all breakpoints die when it ends, so you can misjudge whether your repro conditions still hold.
  • There is no undo for Settings. Before deleting .idea/ in frustration, try to revert the single broken entry in Keymap/Plugins — deleting the directory throws away run configurations, indexes, and Local History.
  • Pushing with Cmd+Shift+K without checking the staged changes can commit breakpoint files or a .env containing secrets; review the diff in the VCS popup (Alt+backtick) first.
  • Find (Alt+F3) and Search Everywhere (Shift+Shift) have different scopes — a replace done in Alt+F3 can miss generated code, so re-verify cross-module edits with Shift+Shift.

Tips

  • Alt+Enter is the universal shortcut; pressing it on a warning/error shows a fix suggestion.
  • Shift+Shift quickly searches anything (classes, files, symbols, actions).
  • Before Cmd+Alt+L reformats code, set up the Code Style first.

FAQ

Which keys jump to a definition versus find usages, and how do I follow an interface implementation?

Cmd+B goes to the definition of the symbol under the cursor, Alt+F7 searches backwards for all usages, Cmd+Alt+B jumps to the concrete implementation, and Cmd+U jumps to the superclass or interface declaration. When reading framework code or chasing an implementation, moving along Cmd+B → Cmd+Alt+B → Cmd+U walks you between abstraction and implementation far more precisely than a text search. Cmd+[ and Cmd+] step back and forward through visited locations, which pairs well with that chain.

What does Shift+Shift search, and why learn it before the navigation keys?

Shift+Shift opens Search Everywhere: one input box that searches classes, files, symbols, actions and settings, including third-party library classes that do not appear in the Project tree. It is the only entry point that does not require you to already know where something lives — search the action name when you cannot recall the shortcut, search a business keyword when you cannot recall the class name. Cmd+P for parameter info and Cmd+Q for quick docs add context once you have located the symbol; plain global text search is still Cmd+Shift+F.

Why is Alt+Enter called the universal shortcut, and what does it actually solve?

It is the entry point for context-sensitive intention actions. With the caret on a line that fails to compile it offers quick fixes; on a class definition it can generate a constructor or getters and setters; with an expression selected it can extract a variable or constant (the same work as Cmd+Alt+V and Cmd+Alt+C); on an interface method it can generate an implementation, and inside a test class a test method. What it saves is hunting through menus — describe your intent at the caret and let the IDE offer executable options.

What should be prepared before a rename or extract-method so the refactor does not fail?

Make sure indexing has completed and the project compiles, since refactorings rely on symbol resolution and will refuse to run or silently miss references on a partial index. Before Shift+F6, check the new name does not collide with an existing class or a statically imported symbol. For Cmd+Alt+M, the selection must not straddle an unclosed construct, and any local variables the block references become parameters. And set your Code Style before running Cmd+Alt+L, or a bulk format will rewrite the file in the default style.

How do I control stepping in a debug session, and how do I get out when something goes wrong?

Control the pace with F8 to step over, F7 to step in, Shift+F8 to step out and Alt+F9 to run to the line holding the cursor. Toggle breakpoints with Cmd+F8 and review them all at once with Cmd+Shift+F8 so you know which module is instrumented. Enter through Ctrl+R to run the current configuration or Ctrl+D to debug it, with Ctrl+Shift+R and Ctrl+Shift+D running just the current file when it needs different parameters. Cmd+F2 stops and Cmd+Alt+R resumes.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us