Site logo
Authors
  • avatar Nguyễn Đức Xinh
    Name
    Nguyễn Đức Xinh
    Twitter
Published on
Published on

GitHub Copilot VS Code Shortcuts: Boost Your Coding Efficiency

GitHub Copilot is a powerful AI-powered coding assistant that helps developers write code faster and smarter. If you're using Copilot with Visual Studio Code (VS Code), mastering its shortcuts can significantly enhance your productivity. This guide covers essential GitHub Copilot shortcuts in VS Code to streamline your workflow.

🔹 Getting Started with GitHub Copilot in VS Code

Before diving into shortcuts, ensure you have GitHub Copilot installed and enabled in VS Code:

  1. Install the GitHub Copilot extension from the VS Code Marketplace.
  2. Sign in with your GitHub account.
  3. Enable Copilot in your settings (Cmd + , on macOS or Ctrl + , on Windows/Linux).

🔥 Essential GitHub Copilot Shortcuts

Here are the must-know shortcuts for efficiently using GitHub Copilot in VS Code:

🚀 Code Suggestions and Completion

Shortcut Description
Tab Accept Copilot's suggestion
Esc Dismiss the suggestion
Alt + ] (Windows/Linux) <br> Option + ] (macOS) Show next suggestion
Alt + [ (Windows/Linux) <br> Option + [ (macOS) Show previous suggestion
Ctrl + Enter (Windows/Linux) <br> Cmd + Enter (macOS) Force generate a suggestion

⚡ Inline Code Generation

Shortcut Description
Option + \ (macOS) Trigger inline Copilot suggestion

✨ Working with Copilot Code Editor

Shortcut Description
Ctrl + Shift + i (Windows/Linux) <br> Cmd + Shift + i (macOS) Open Copilot Code Editor
Ctrl + Enter (Windows/Linux) <br> Cmd + Enter (macOS) Accept
Ctrl + Space (Windows/Linux) <br> Cmd + Space (macOS) Discard

✨ Working with Copilot Chat Inline

Shortcut Description
Ctrl + i (Windows/Linux) <br> Cmd + i (macOS) Open Copilot Chat Inline
/ in Copilot Chat Start a command prompt
Shift + Enter Send a multi-line prompt

✨ Working with Copilot Chat

Shortcut Description
Ctrl + Alt + i (Windows/Linux) <br> Cmd + control + i (macOS) Open Copilot Chat
/ in Copilot Chat Start a slash command prompt
/doc Adds a documentation comment
/explain Explains the selected code
/fix Proposes a fix for problems in the selected code
/test Generates unit tests for the selected code
@ in Copilot Chat Mention a specific AI assistant
# in Copilot Chat Attach context to your prompt
Shift + Enter Send a multi-line prompt

📌 Bonus Tips for Maximizing Copilot

  • Use comments to guide Copilot (e.g., // Create a function to fetch data from API).
  • Combine Copilot with VS Code Snippets for even faster coding.
  • Use Copilot in Jupyter Notebooks for Python-based data science workflows.
  • Customize Your Shortcuts: If these shortcuts don’t align with your workflow, you can always customize them in VS Code. Go to File > Preferences > Keyboard Shortcuts and search for “Copilot” to remap the keys to your liking.

🎯 Conclusion

By mastering these GitHub Copilot shortcuts in VS Code, you can boost your coding speed and efficiency. Whether you’re writing code, debugging, or experimenting with AI-generated suggestions, Copilot can be a game-changer.