Here are some useful shortcut commands for using GitHub Copilot:
-
Ctrl + Enter(orCmd + Enteron 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 + Spaceon Mac): Trigger GitHub Copilot to generate code based on the context of your code. -
Ctrl + Shift + Space(orCmd + Shift + Spaceon Mac): Trigger GitHub Copilot to generate code based on the context of your code, but with more context. -
Ctrl + Shift + Enter(orCmd + Shift + Enteron 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 errorin the chat.
-
Type
/apiin the chat to get the API for the code. -
Type
/explainin the chat to get an explanation of the code. -
Type
/fixin the chat to get a fixed version of the code. -
Type
/newin the chat to create a new project with some scaffold code. -
Type
/newNotebookin the chat to create a new Jupyter notebook. -
Type
/testin the chat to generate unit test. -
Type
/helpin the chat to get help with the commands. -
Type
/clearin the chat to clear the chat window.
-
Type
@terminalin the chat to handle/run queries on/about terminal output(s)/error(s). -
Type
@vscodein the chat to handle/run queries on/about VSCode output(s)/error(s). -
Type
@workspacein the chat to run queries on/about workspace.
-
Type
#editorin the chat to handle/run queries on/about editor output(s)/error(s). -
Type
#filein the chat to handle/run queries on/about file output(s)/error(s). -
Type
#selectionin the chat to handle/run queries on/about selected output(s)/error(s). -
Type
#TerminalLastCommandin the chat to handle/run queries on/about the last command in the terminal. -
Type
#TerminlSelectionin the chat to handle/run queries on/about selected terminal output(s)/error(s).
Press Ctrl + I to open inline GitHub Copilot Chat
-
Type
/docin the chat to get the documentation for the code. -
Type
/explainin the chat to get an explanation of the code. -
Type
/fixin the chat to get a fixed version of the code. -
Type
/testin 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

