Aller au contenu principal

All vscode Keyboard Shortcuts

Windows & Mac Keyboard Shortcuts

I'll provide you with a comprehensive list of Visual Studio Code (VS Code) keyboard shortcuts for web development, along with detailed explanations for each shortcut and its purpose.

Basic Editing:

  1. Copy: Ctrl+C (Cmd+C on Mac)

    • Explanation: This shortcut allows you to copy selected text or content to the clipboard. It's useful when you want to duplicate a piece of code or text.
  2. Cut: Ctrl+X (Cmd+X on Mac)

    • Explanation: This shortcut cuts or removes the selected text or content and places it in the clipboard. It's handy for moving code or text to a different location.
  3. Paste: Ctrl+V (Cmd+V on Mac)

    • Explanation: This shortcut pastes the content from the clipboard to the current cursor position. It's used for inserting copied or cut text.
  4. Undo: Ctrl+Z (Cmd+Z on Mac)

    • Explanation: Undo allows you to revert the last action you performed. It's useful for quickly correcting mistakes or accidental changes.
  5. Redo: Ctrl+Y (Cmd+Y on Mac)

    • Explanation: Redo reverses the undo action, essentially redoing the previously undone action. It's helpful for reapplying changes that you've undone.
  6. Find: Ctrl+F (Cmd+F on Mac)

    • Explanation: This shortcut opens the Find dialog, allowing you to search for specific text or code within the current file. It's useful for locating and navigating to specific code snippets.
  7. Replace: Ctrl+H (Cmd+Option+F on Mac)

    • Explanation: Replace opens the Replace dialog, which enables you to find and replace specific text or code throughout the current file. It's handy for making global changes.
  8. Save: Ctrl+S (Cmd+S on Mac)

    • Explanation: Save lets you save the current file with any modifications you've made. It's essential for preserving your work.
  9. Save All: Ctrl+K S (Cmd+Option+S on Mac)

    • Explanation: Save All saves all open files with changes. This is particularly useful when you're working with multiple files simultaneously.
  10. Toggle Comment: Ctrl+/ (Cmd+/ on Mac)

    • Explanation: Toggle Comment comments or uncomments selected lines of code. It's useful for adding or removing comments in your code quickly.
  1. Go to File: Ctrl+P (Cmd+P on Mac)

    • Explanation: Go to File opens a quick file navigation dialog, allowing you to search and open files within your project by entering their names.
  2. Go to Line: Ctrl+G (Cmd+G on Mac)

    • Explanation: Go to Line lets you jump to a specific line number in the current file. It's handy for navigating large files.
  3. Go to Definition: F12

    • Explanation: Go to Definition takes you to the source code definition of a variable, function, or class when you place the cursor over it. This is especially useful for understanding your codebase.
  4. Go to Symbol: Ctrl+Shift+O (Cmd+Shift+O on Mac)

    • Explanation: Go to Symbol allows you to quickly navigate to symbols (such as functions, classes, and variables) within the current file.
  5. Toggle Sidebar: Ctrl+B (Cmd+B on Mac)

    • Explanation: Toggle Sidebar hides or shows the sidebar on the left-hand side of the VS Code interface, providing more space for your code when needed.

Code Formatting:

  1. Format Document: Shift+Alt+F (Shift+Option+F on Mac)

    • Explanation: Format Document automatically formats the code in the current document based on your configured code formatting settings. It ensures consistent code styling.
  2. Format Selection: Ctrl+K Ctrl+F (Cmd+K Cmd+F on Mac)

    • Explanation: Format Selection formats only the selected code or text according to your formatting settings. This is helpful for formatting specific sections of your code.

Git Integration:

  1. Open Source Control: Ctrl+Shift+G (Cmd+Shift+G on Mac)

    • Explanation: Open Source Control provides access to Git version control within VS Code. It shows the current status of your repository and allows you to stage, commit, and manage changes.
  2. Stage Changes: Ctrl+Alt+S (Cmd+Option+S on Mac)

    • Explanation: Stage Changes adds your modified files to the staging area in Git, preparing them for the next commit.
  3. Commit Changes: Ctrl+Enter (Cmd+Enter on Mac)

    • Explanation: Commit Changes creates a new commit in your Git repository with the staged changes, along with a commit message.
  4. Push: Ctrl+Shift+P (Cmd+Shift+P on Mac)

    • Explanation: Push pushes your committed changes to a remote Git repository, keeping it in sync with your local changes.

Integrated Terminal:

  1. Open Terminal: Ctrl+`

    • Explanation: Open Terminal opens an integrated terminal window within VS Code, allowing you to run command-line commands without leaving the editor.
  2. Close Terminal: Ctrl+`

    • Explanation: Close Terminal closes the integrated terminal window when you no longer need it.
  3. Toggle Terminal: Ctrl+`

    • Explanation: Toggle Terminal opens or closes the integrated terminal, making it easy to switch between your code and the terminal as needed.

These detailed explanations should help you understand the purpose and functionality of each keyboard shortcut in Visual Studio Code.