← Back to Week 1 Hub

IntelliJ Shortcuts & Pro Tips

The shortcuts and tricks Raymond uses in class — the fastest way to move around IntelliJ and write less code by hand

🔍
Navigation Editing Completion Refactoring Run & Debug Selection Tool Windows Postfix Templates Live Templates Pro Tips
How to read the keys: Toggle the platform at the top. On Mac, = Command, = Option/Alt, = Control, = Shift. If a shortcut ever doesn’t work, open Help → Keymap Reference in IntelliJ — your keymap might be different.
Editing 9
Duplicate Line / Selection
Makes a copy of the current line (or selected block) right below.
Ctrl+D
+D
Delete Line
Deletes the whole line your cursor is on — no selecting needed.
Ctrl+Y
+
Move Line Up / Down
Pushes the current line up or down through the file. Great for reordering.
Shift+Alt+ /
++ /
Comment / Uncomment Line
Toggles // on the current line or selection.
Ctrl+/
+/
Block Comment
Wraps selection in /* ... */.
Ctrl+Shift+/
++/
Reformat Code
Cleans up spacing, indentation, and braces. Do this before every commit.
Ctrl+Alt+L
++L
Optimize Imports
Removes unused imports and sorts them. Pair with Reformat Code.
Ctrl+Alt+O
++O
Undo / Redo
Undo any change. IntelliJ keeps a deep history even after you close a file.
Ctrl+Z / Ctrl+Shift+Z
+Z / ++Z
Save All
IntelliJ auto-saves, but this forces it. Useful before running.
Ctrl+S
+S
Code Completion & Generation 8
Basic Completion
Show all possible completions for the current token.
Ctrl+Space
+Space
Smart Completion
Only shows completions that match the expected type. Great when assigning to a variable.
Ctrl+Shift+Space
++Space
Quick Fix / Show Intentions
The lightbulb. Auto-imports, creates missing methods, fixes errors. The single most useful shortcut in IntelliJ.
Alt+Enter
+Enter
Complete Statement
Adds the missing ;, closing brace, or parentheses so the line parses.
Ctrl+Shift+Enter
++Enter
Generate…
Opens a menu to create getters, setters, constructors, toString(), equals().
Alt+Insert
+N
Parameter Info
Shows the parameters a method expects while you’re inside the parentheses.
Ctrl+P
+P
Quick Documentation
Pops up Javadoc for whatever the cursor is on. Great for remembering what a method does.
Ctrl+Q
F1
Surround With…
Wrap a selection in if, try/catch, a loop, or braces — no retyping.
Ctrl+Alt+T
++T
Refactoring 6
Rename
Rename a variable, method, class, or file — IntelliJ updates every usage for you. Much safer than Find & Replace.
Shift+F6
+F6
Extract Variable
Pull an expression into a named variable.
Ctrl+Alt+V
++V
Extract Method
Turn a block of code into its own method, with parameters auto-filled.
Ctrl+Alt+M
++M
Extract Constant
Turn a literal like 3.14 into a static final constant.
Ctrl+Alt+C
++C
Extract Parameter
Promote a local variable into a method parameter.
Ctrl+Alt+P
++P
Refactor This…
Opens a menu of every refactoring that applies to the current spot.
Ctrl+Alt+Shift+T
+T
Run & Debug 8
Run
Run the current program (uses the last run configuration).
Shift+F10
+R
Debug
Run with the debugger attached. Breakpoints become active.
Shift+F9
+D
Toggle Breakpoint
Turn a breakpoint on or off on the current line. Or just click the gutter.
Ctrl+F8
+F8
Step Over
Run the current line and stop on the next one (don’t dive into methods).
F8
F8
Step Into
Dive into the method being called on the current line.
F7
F7
Step Out
Finish the current method and stop at the caller.
Shift+F8
+F8
Resume Program
Keep running until the next breakpoint.
F9
++R
Evaluate Expression
While paused at a breakpoint, run any Java expression against the current state.
Alt+F8
+F8
Selection & Multi-Cursor 5
Extend Selection
Keep pressing to expand selection by word, expression, statement, method…
Ctrl+W
+
Shrink Selection
Opposite of Extend — shrinks the selection back down.
Ctrl+Shift+W
+
Add Caret on Next Occurrence
Select the same word again — each press adds another cursor. Type once, change everywhere.
Alt+J
+G
Select All Occurrences
Add a cursor to every matching word in the file at once.
Ctrl+Alt+Shift+J
++G
Column (Box) Selection
Hold this, then drag with the mouse — rectangular selection across lines.
Alt + drag
+ drag
Tool Windows 7
Project Tool Window
Open/close the project sidebar (file tree).
Alt+1
+1
Structure View
Outline of the current file — every method and field at a glance.
Alt+7
+7
Terminal
Open the built-in terminal (already in the project folder).
Alt+F12
+F12
Git / Commit Tool Window
Shows current Git status, history, and lets you commit.
Alt+9
+9
Close Active Tool Window
Hide whatever popup or side panel is currently active and go back to the editor.
Shift+Esc
+Esc
Hide All Tool Windows
Kills all side panels for distraction-free coding. Press again to bring them back.
Ctrl+Shift+F12
++F12
Switcher
Cycle through open files and tool windows, Alt-Tab style.
Ctrl+Tab
+Tab
Postfix Templates 8
How they work: Type an expression, then . and one of these suffixes, then Tab. IntelliJ rewrites the expression around it. Example: type names.for and press Tab → IntelliJ writes the full for loop for you.
.sout
"hello".soutSystem.out.println("hello");
.var
scanner.nextInt().varint i = scanner.nextInt();
.if
isValid.ifif (isValid) { }
.null / .nn
name.nullif (name == null) { }. .nn is the not-null version.
.for
names.for → enhanced for (String name : names) { }
.fori
10.forifor (int i = 0; i < 10; i++) { }
.return
result.returnreturn result;
.not
isValid.not!isValid
Live Templates 7
How they work: Type the abbreviation anywhere in your file and press Tab. IntelliJ expands it into a full code snippet.
psvm
Expands to public static void main(String[] args) { }.
sout
Expands to System.out.println(); — cursor lands inside the parens.
soutv
Prints the nearest variable with its name: System.out.println("name = " + name);
soutm
Prints the current class/method name. Great for tracing which method ran.
fori
Classic indexed for (int i = 0; i < ; i++) { }.
iter
Enhanced for over the nearest array or collection in scope.
ifn
Expands to if (x == null) { } using the last variable in scope.
Pro Tips (not shortcuts, but gold) 8
Local History
Right-click a file → Local History → Show History. IntelliJ keeps a personal version history of every file — even without Git. If you accidentally delete code, recover it here.
Run Anything (double Ctrl)
Tap Ctrl twice (Windows) or twice (Mac) to open “Run Anything” — run main classes, Maven goals, or any command.
Scratch Files
Need to try something without polluting your project? File → New → Scratch File → Java. IntelliJ treats it like a real class but keeps it outside your repo.
Presentation Mode
View → Appearance → Enter Presentation Mode. Huge font and zero distractions — useful when you want to read your own code from across the room or pair with someone.
Annotate (Git Blame)
Right-click the gutter (next to line numbers) → Annotate with Git Blame. Shows who last changed each line and when.
Inspect Code
Code → Inspect Code. Runs IntelliJ’s full static analysis over the whole project — finds unused vars, dead code, likely bugs, and more.
Auto-reformat on Commit
In the Commit tool window, check Reformat code and Optimize imports. IntelliJ will clean every commit automatically — one less thing to remember.
TODO Comments
Write // TODO: in your code and IntelliJ highlights it. Open the TODO tool window (View → Tool Windows → TODO) to see every TODO across the project.
No shortcuts match that search.

Tip: bookmark this page — you’ll use it all through the bootcamp. Keymap: IntelliJ Default. On Mac, if a shortcut collides with the OS, open Settings → Keymap to rebind it.