Curious Minds

Clear answers to science and history questions

VS Code Cheat Sheet – Essential Shortcuts and Commands

· 5 min read · Science

Yes, a Visual Studio Code cheat sheet can be summarized in a single page. It lists the most frequently used shortcuts, commands, and settings you need for day‑to‑day coding.

Core Navigation Shortcuts for Speedy File Access

Quickly opening, switching, and closing files keeps your mind on the problem rather than the interface. The following keys work on Windows/Linux; replace Ctrl with Cmd on macOS.

  1. Show All Commands: Ctrl+Shift+P – opens the command palette where you can type any command name.
  2. Quick Open: Ctrl+P – type a file name, path fragment, or symbol to jump instantly.
  3. Toggle Sidebar: Ctrl+B – hides or reveals the explorer, keeping more screen space for code.
  4. Next/Previous Editor: Ctrl+Tab / Ctrl+Shift+Tab – cycles through open tabs in most‑recent order.
  5. Close Editor: Ctrl+W – removes the current tab without prompting.

How do I open a recently closed file?

Press Ctrl+Shift+T. This restores the last closed editor, and you can repeat the shortcut to step further back through the history.

Essential Editing Shortcuts to Reduce Repetitive Work

Editing shortcuts let you manipulate text without leaving the keyboard. Mastering these few commands can cut typing time dramatically.

  • Copy Line Up/Down: Alt+Shift+Up / Alt+Shift+Down – duplicates the current line or selection.
  • Move Line Up/Down: Alt+Up / Alt+Down – reorders lines without cut‑paste.
  • Multi‑cursor Add: Alt+Click – places additional cursors at clicked locations.
  • Select All Occurrences: Ctrl+F2 – highlights every instance of the current word.
  • Rename Symbol: F2 – renames a variable, function, or class across the workspace.
  • Comment Line: Ctrl+/ – toggles line comment for the current language.
  • Block Comment: Shift+Alt+A – toggles block comment delimiters.
  • Format Document: Shift+Alt+F – applies the formatter configured for the file type.

What if the formatter does nothing?

Check that a formatter extension is installed for the language and that editor.formatOnSave is enabled in Settings.

Debugging Shortcuts That Keep You in the Flow

When you start a debugging session, the same keyboard layout controls breakpoints, stepping, and inspection. These shortcuts work after you launch a debug configuration.

  1. Toggle Breakpoint: F9 – adds or removes a breakpoint on the current line.
  2. Start/Continue: F5 – begins debugging or resumes after a pause.
  3. Step Over: F10 – executes the current line and moves to the next.
  4. Step Into: F11 – dives into the function call on the current line.
  5. Step Out: Shift+F11 – runs until the current function returns.
  6. Restart Debugging: Ctrl+Shift+F5 – stops and starts the session anew.
  7. Stop Debugging: Shift+F5 – ends the session immediately.

Can I watch a variable without adding a breakpoint?

Open the Debug Console ( Ctrl+Shift+Y ) and type the variable name. The console evaluates it in the current context.

Integrated Terminal Shortcuts for Seamless Command Line Use

The built‑in terminal lets you run scripts, git commands, and build tools without leaving VS Code. Use these shortcuts to manage panels quickly.

  • Toggle Terminal: Ctrl+` – shows or hides the terminal panel.
  • Create New Terminal: Ctrl+Shift+` – opens an additional terminal instance.
  • Switch Terminal: Ctrl+PageDown / Ctrl+PageUp – cycles through multiple terminals.
  • Clear Terminal: Ctrl+K – empties the terminal output.
  • Copy Selection: Ctrl+Shift+C – copies highlighted text without affecting the system clipboard shortcut.
  • Paste Into Terminal: Ctrl+Shift+V – pastes from the clipboard directly.

What if the terminal does not focus after opening?

Press Ctrl+` again or click inside the panel. If focus still fails, check the setting terminal.integrated.focusAfterRunCommand.

Customization Tips: Settings, Snippets, and Extensions

Beyond shortcuts, VS Code’s power lies in personalizing the environment. The following items are easy to adjust without leaving the editor.

  1. Keybinding Editor: Open with Ctrl+K Ctrl+S. Search for a command and assign a new shortcut.
  2. Settings JSON: Open with Ctrl+, then click the top‑right {} icon. Directly edit settings.json for fine‑grained control.
  3. User Snippets: Use Ctrl+Shift+P → “Configure User Snippets”. Define reusable code blocks for any language.
  4. Extension Recommendations: Press Ctrl+Shift+X to browse. Install language packs, linters, or theme extensions to suit your workflow.
  5. Workspace Layout: Drag tabs to split editors horizontally (Ctrl+\) or vertically (Ctrl+Alt+\). This keeps related files visible side by side.

How can I revert an unwanted keybinding change?

Open the Keybinding Editor, locate the modified command, and click the reset arrow next to the shortcut. The default binding returns instantly.

Quick Reference Table for OS‑Specific Modifier Keys

The table below shows the equivalent modifier for the most common shortcuts. Remember the rule of thumb: replace Ctrl with Cmd on macOS, and keep Alt as Option when the shortcut mentions it.

Action Windows / Linux macOS
Show Command Palette Ctrl+Shift+P Cmd+Shift+P
Quick Open File Ctrl+P Cmd+P
Toggle Terminal Ctrl+` Cmd+`
Comment Line Ctrl+/ Cmd+/
Format Document Shift+Alt+F Shift+Option+F

Use this table whenever you switch between operating systems to avoid missing a key.

Putting the Cheat Sheet to Use: A Sample Workflow

Imagine you are fixing a typo across several files. Follow these steps to see the cheat sheet in action.

  1. Press Ctrl+Shift+P, type “Rename Symbol”, and hit Enter. The rename UI appears.
  2. Enter the corrected word and confirm with Enter. All occurrences update instantly.
  3. If a file is not opened, press Ctrl+P, type part of its name, and hit Enter to jump to it.
  4. While reviewing, use Ctrl+F2 to highlight every remaining instance of the old spelling.
  5. When you find a stray line, press Alt+Shift+Down to duplicate it, edit the copy, then delete the original with Ctrl+W.
  6. Finally, press Shift+Alt+F to format the file, ensuring consistent indentation.

This short loop demonstrates how the cheat sheet reduces mouse clicks and keeps you focused on code logic.

Rule of Thumb for Learning New Shortcuts

Pick three shortcuts each week, practice them until they become muscle memory, then add three more. After a month you will have a solid core set without feeling overwhelmed.

In this article
  1. Core Navigation Shortcuts for Speedy File Access
  2. Essential Editing Shortcuts to Reduce Repetitive Work
  3. Debugging Shortcuts That Keep You in the Flow
  4. Integrated Terminal Shortcuts for Seamless Command Line Use
  5. Customization Tips: Settings, Snippets, and Extensions
  6. Quick Reference Table for OS‑Specific Modifier Keys
  7. Putting the Cheat Sheet to Use: A Sample Workflow
  8. Rule of Thumb for Learning New Shortcuts