Here are some useful shortcut commands for using GitHub Copilot:
-
Ctrl + Enter
(orCmd + Enter
on Mac): Open the suggestion panel to view alternative suggestions. -
Tab
: Accept the current suggestion. -
Shift + Tab
: Cycle through the available suggestions. -
Ctrl + .
(orCmd + .
on Mac): Open the context menu to view more options. -
Ctrl + Space
(orCmd + Space
on Mac): Trigger GitHub Copilot to generate code based on the context of your code. -
Ctrl + Shift + Space
(orCmd + Shift + Space
on Mac): Trigger GitHub Copilot to generate code based on the context of your code, but with more context. -
Ctrl + Shift + Enter
(orCmd + Shift + Enter
on Mac): Trigger GitHub Copilot to generate code based on the context of your code, but with even more context.
- Select the code throwing error(s) and type
Handle error
in the chat.
-
Type
/api
in the chat to get the API for the code. -
Type
/explain
in the chat to get an explanation of the code. -
Type
/fix
in the chat to get a fixed version of the code. -
Type
/new
in the chat to create a new project with some scaffold code. -
Type
/newNotebook
in the chat to create a new Jupyter notebook. -
Type
/test
in the chat to generate unit test. -
Type
/help
in the chat to get help with the commands. -
Type
/clear
in the chat to clear the chat window.
-
Type
@terminal
in the chat to handle/run queries on/about terminal output(s)/error(s). -
Type
@vscode
in the chat to handle/run queries on/about VSCode output(s)/error(s). -
Type
@workspace
in the chat to run queries on/about workspace.
-
Type
#editor
in the chat to handle/run queries on/about editor output(s)/error(s). -
Type
#file
in the chat to handle/run queries on/about file output(s)/error(s). -
Type
#selection
in the chat to handle/run queries on/about selected output(s)/error(s). -
Type
#TerminalLastCommand
in the chat to handle/run queries on/about the last command in the terminal. -
Type
#TerminlSelection
in the chat to handle/run queries on/about selected terminal output(s)/error(s).
Press Ctrl + I
to open inline GitHub Copilot Chat
-
Type
/doc
in the chat to get the documentation for the code. -
Type
/explain
in the chat to get an explanation of the code. -
Type
/fix
in the chat to get a fixed version of the code. -
Type
/test
in the chat to generate unit test.
GitHub Copilot has a few easter eggs too! For example, try typing import antigravity
in a Python file and see what happens.
GitHub Copilot is a powerful tool that can significantly speed up your coding process. With these tips and tricks, you'll be able to get the most out of it. Happy coding!
https://github.com/microsoft/CopilotHackathon/blob/main/Resources/GHCP%20Cheatsheet.md