VS Code Shortcuts for Mac

General Shortcuts:

  • Command + Shift + P or F1: Opens the Command Palette, allowing you to search for and execute commands.
  • Command + P: Quickly search for and open files by typing their names.
  • Command + Shift + N: Opens a new VS Code window.
  • Command + Shift + W: Closes the current VS Code window.

Basic Editing:

  • Command + Shift + P or F1: Opens the Command Palette, allowing you to search for and execute commands.
  • Command + P: Quickly search for and open files by typing their names.
  • Command + Shift + N: Opens a new VS Code window.
  • Command + Shift + W: Closes the current VS Code window.
  • Command + X: Cuts the entire line without selecting it.
  • Command + C: Copies the entire line without highlighting it.
  • Command + V: Pastes the copied or cut content.
  • Command + Z: Undoes your last action.
  • Command + Shift + Z: Redoes the action you just undid.
  • Command + Shift + K: Deletes the entire line.
  • Command + Enter: Inserts a new line below the current one.
  • Command + Shift + Enter: Inserts a new line above the current one.
  • Command + Shift + \: Jumps to the matching bracket, useful for navigating code blocks.
  • Command + /: Toggles a comment on the current line.
  • Option + Shift + A: Toggles a block comment around selected code.
  • Option + Up/Down Arrow: Moves the current line up or down.
  • Option + Shift + Up/Down Arrow: Duplicates the line and moves the copy up or down.
  • Command + D: Selects the next occurrence of the highlighted word.
  • Command + L: Highlights the entire current line.
  • Command + Shift + L: Selects all instances of the current selection.
  • Command + F2: Selects every occurrence of the word under the cursor.

Multi-Cursor and Selection:

  • Option + Click: Adds a new cursor wherever you click, allowing you to type in multiple places simultaneously.
  • Command + Option + Up/Down Arrow: Adds a new cursor directly above or below the current one.
  • Command + Shift + Left/Right Arrow: Selects text one word at a time.
  • Option + Shift + Right/Left Arrow: Expands or reduces the selected text.

Search and Replace:

  • Command + F: Opens the search bar to find text within the current file.
  • Command + Option + F: Opens the replace bar to find and replace text within the file.
  • Command + G / Shift + Command + G: Finds the next or previous occurrence of your search term.
  • Command + Shift + F: Searches for text across all files in your project.
  • Command + Shift + H: Replaces text across all files in your project.

Navigation:

  • Command + T: Shows all symbols (like functions or variables) in the file for quick navigation.
  • Command + G: Jumps to a specific line number.
  • Command + Shift + O: Quickly navigates to any symbol in the current file.
  • Control + – / Control + Shift + -: Moves back or forward to the cursor’s previous or next location.
  • F12: Jumps directly to the definition of the symbol under the cursor.
  • Option + F12: Peeks at the definition without leaving the current file.
  • Command + K, Command + I: Displays a tooltip with more information about the symbol under the cursor.
  • Command + B: Hides or shows the sidebar.
  • Command + Shift + E: Opens the Explorer, showing the project’s file structure.
  • Command + Shift + G: Opens the Source Control view for managing version control (e.g., Git).
  • Command + Shift + D: Opens the Debug panel to configure and run debugging.
  • Command + Shift + X: Opens the Extensions panel for managing extensions.
  • Command + Shift + U: Opens the Output panel for logs and output.
  • Control + `: Toggles the integrated terminal.

File Management:

  • Command + N: Creates a new empty file.
  • Command + O: Opens an existing file.
  • Command + S: Saves the current file.
  • Command + Shift + S: Saves the current file with a new name.
  • Command + Option + S: Saves all currently open files.
  • Command + W: Closes the current file.
  • Command + Shift + T: Reopens the last closed file.
  • Command + K, Command + W: Closes all open files.

Integrated Terminal:

  • Control + `: Toggles the integrated terminal.
  • Command + Shift + `: Creates a new terminal instance.
  • Command + C: Copies selected text in the terminal.
  • Command + V: Pastes text into the terminal.
  • Control + Arrow Up/Down: Scrolls through the terminal output history.
  • Command + K: Clears the terminal output.

Debugging:

  • F9: Adds or removes a breakpoint on the current line.
  • F5: Starts or resumes the debugging process.
  • Shift + F5: Stops the debugging session.
  • F11 / Shift + F11: Steps into or out of a function during debugging.
  • F10: Steps over the next function call.

Window Management:

  • Command + `: Toggles the terminal window.
  • Command + 1 / 2 / 3: Switches focus to editor group 1, 2, or 3.
  • Command + K, Command + Left/Right Arrow: Moves between editor groups.
  • Command + Shift + P: Opens the Command Palette for searching and executing commands.

Leave a Comment