VS Code shortcuts

VS Code shortcuts

whats the shortcut to jump to a line number in VS Code?

Leo AI said:
Ctrl + G
 (Windows/Linux) or Cmd + G (macOS) is the primary shortcut to jump to a specific line number in Visual Studio Code. 

After pressing the shortcut, a prompt appears at the top of the editor where you can enter the desired line number and press Enter to navigate directly to that line. 

This method is the fastest and most commonly used way to jump to a specific line in VS Code. 

You Said:
Can you give me a cheat sheet for additional VS Code shortcuts, starting from the most popular useful firstFinished

Leo AI said:
Here is a concise cheat sheet of the most popular and useful VS Code shortcuts, starting with the essentials:

General & Navigation

  • Ctrl + Shift + P (Cmd + Shift + P on Mac): Open Command Palette
  • Ctrl + P (Cmd + P): Go to file
  • Ctrl + G (Cmd + G): Jump to line number
  • Ctrl + Shift + O (Cmd + Shift + O): Go to symbol in file
  • Ctrl + T (Cmd + T): Show all symbols (workspace-wide)
  • F8 / Shift + F8: Go to next/previous error or warning 

File Management

  • Ctrl + N (Cmd + N): New file
  • Ctrl + O (Cmd + O): Open file
  • Ctrl + S (Cmd + S): Save file
  • Ctrl + Shift + S (Cmd + Shift + S): Save As
  • Ctrl + W (Cmd + W): Close file
  • Ctrl + Shift + T (Cmd + Shift + T): Reopen closed tab 

Editing

  • Ctrl + C / Ctrl + X / Ctrl + V (Cmd equivalents): Copy, cut, paste
  • Ctrl + Z / Ctrl + Y (Cmd + Z / Cmd + Shift + Z): Undo / Redo
  • Ctrl + D (Cmd + D): Add cursor to next match
  • Ctrl + L (Cmd + L): Select entire line
  • Ctrl + Shift + L: Select all occurrences of current selection
  • Alt + ↑ / ↓ (Option + ↑ / ↓ on Mac): Move line up/down
  • Ctrl + / (Cmd + /): Comment/uncomment line
  • Shift + Alt + A (Shift + Option + A): Block comment/uncomment 

Search & Replace

  • Ctrl + F (Cmd + F): Find in file
  • Ctrl + H (Cmd + Option + F): Replace in file
  • Ctrl + Shift + F (Cmd + Shift + F): Find in files
  • Ctrl + Shift + H (Cmd + Shift + H): Replace in files 

View & Layout

  • Ctrl + B (Cmd + B): Toggle Sidebar
  • F11 (Cmd + Ctrl + F): Full screen mode
  • Ctrl + ` (Ctrl + `): Toggle Terminal
  • Ctrl + \ (Cmd + \): Split editor
  • Ctrl + 1 / 2 / 3 (Cmd + 1 / 2 / 3): Focus on editor group 

You said:
Is the shortcut to tidy the indentations of the coding listed here?

Leo AI said:
No, the shortcut to tidy or fix indentation is not listed in the previous cheat sheet. Here are the relevant shortcuts:

  • Shift + Alt + F (Windows/Linux) or Shift + Option + F (macOS): Format the entire file, fixing indentation and applying language-specific rules. 
  • Ctrl + K, then Ctrl + F: Format only the selected code. 
  • Ctrl + ]: Increase indentation of selected lines by one level. 
  • Ctrl + [: Decrease indentation of selected lines by one level. 

These commands will tidy up code indentation based on your formatter settings (e.g., Prettier, ESLint).

You said:
Shift + Alt + F popped up the File menu dude 🙄

Leo AI said:
Shift + Alt + F opens the File menu because your keyboard layout or focus is interfering with the shortcut. This commonly happens if:

  • The editor isn't focused (click inside the code window first).
  • Your keyboard input source is set to a non-US layout (e.g., ABC – India). Switch to ABC or US International in your system settings. 
  • The shortcut is overridden or not mapped correctly.

Fix:

  1. Press Ctrl + Shift + P → type "Format Document" → run it manually. 
  2. Go to File > Preferences > Keyboard Shortcuts and search for "Format Document" to verify or rebind the shortcut. 
  3. Ensure a formatter (like Prettier) is installed and set as default.