Learn

The shortcuts that change everything

Antigravity

About twenty VS Code shortcuts to memorize to save hours.

Shortcuts are the difference between an editor you put up with and one that obeys your thoughts. This lesson gives you the short list of shortcuts that actually pay off, ranked by frequency of use.

On macOS, replace Ctrl with Cmd everywhere. Alt becomes Option.

Quick Open - open any file Ctrl+P

Type a few letters of the filename and it appears instantly. This is the most-used shortcut. Forget the Explorer panel for navigating between files.

Command Palette - every command Ctrl+Shift+P

Access to all VS Code and extension commands. If you do not know the shortcut for an action, open the palette and type the name of the action.

Go to line Ctrl+G

Jump directly to a numbered line. Useful when an error message says line 247.

Go to definition F12

Opens the definition of a function, class, or type. Essential for exploring an unfamiliar codebase.

Go back after a jump Alt+

Returns to where you jumped from (after F12 or clicking a link). The browser "back" button but for code.

Editing

Multi-cursor on the next occurrence Ctrl+D

Selects the word under the cursor, then each subsequent Ctrl+D adds a cursor on the next occurrence. Ideal for renaming a variable in a file without using Rename Symbol.

Select all occurrences Ctrl+Shift+L

Selects all occurrences of the currently selected text in the file at once. Perfect for a global rename within the current file.

Move a line Alt+ / Alt+

Moves the current line (or selection) up or down without cut/paste.

Duplicate a line Shift+Alt+

Copies the current line below it. Faster than Ctrl+C then Ctrl+V on the next line.

Delete a line Ctrl+Shift+K

Deletes the current line without touching the clipboard. Much faster than Ctrl+X.

Comment / uncomment Ctrl+/

Comments or uncomments the current line (or selection). Uses the syntax of the current language.

Folding and unfolding code

Fold a block Ctrl+Shift+[

Collapses the code block from the current line (function, class, object).

Unfold a block Ctrl+Shift+]

Expands the collapsed block at the cursor position.

Terminal and panel

Open/close the integrated terminal Ctrl+` (backtick, the key below Escape)

Toggles the integrated terminal. It opens in the current project folder.

Open a new terminal Ctrl+Shift+`

Creates a new terminal alongside the one already open.

Check off steps to unlock what comes next

Back to course