GitHub Copilot provides inline code suggestions as you type in Visual Studio Code. By default, the hotkeys to accept or dismiss these suggestions are set by VS Code. Many users find the default keys conflict with other extensions or personal preferences. This article explains how to locate the correct keybinding settings and change the hotkeys for accepting, dismissing, and cycling through GitHub Copilot inline suggestions. You will learn the exact menu paths and JSON keys to modify.
Key Takeaways: Remap GitHub Copilot Keyboard Shortcuts in VS Code
- File > Preferences > Keyboard Shortcuts: Opens the full list of all VS Code commands including Copilot actions.
- Search field in Keyboard Shortcuts view: Type “Copilot” to filter only Copilot-related commands.
- keybindings.json file: Edit this file directly to assign custom keys with the “when” clause “editorTextFocus && inlineSuggestionVisible”.
Understanding the Default GitHub Copilot Inline Suggestion Hotkeys
GitHub Copilot’s inline suggestions appear as gray text directly in the editor. The default hotkeys are defined by VS Code, not by the Copilot extension itself. The three primary actions are:
- Accept a suggestion: Press Tab or Enter. Tab is the most common default.
- Dismiss a suggestion: Press Escape.
- Cycle through suggestions: Use Alt+] (next) and Alt+[ (previous).
These keys are not stored in the Copilot extension settings. They are part of VS Code’s global keybinding system. Changing them requires editing the Keyboard Shortcuts file. The commands you need to remap are editor.action.inlineSuggest.commit for accepting, editor.action.inlineSuggest.hide for dismissing, editor.action.inlineSuggest.showNext for next suggestion, and editor.action.inlineSuggest.showPrev for previous suggestion.
Steps to Change the Inline Suggestion Hotkey
Follow these steps to assign a new hotkey to any GitHub Copilot inline suggestion command.
Method 1: Using the Keyboard Shortcuts Editor
- Open Keyboard Shortcuts
In VS Code, open the command palette with Ctrl+K then Ctrl+S. Alternatively, go to File > Preferences > Keyboard Shortcuts. - Search for the Copilot command
In the search field at the top of the Keyboard Shortcuts view, typeinlineSuggest. This filters all commands related to inline suggestions. You will see entries like “Accept Inline Suggestion”, “Hide Inline Suggestion”, “Show Next Inline Suggestion”, and “Show Previous Inline Suggestion”. - Change a keybinding
Right-click the command you want to change, for example “Accept Inline Suggestion”. Select Change Keybinding. A dialog appears. Press the new key combination, then press Enter to confirm. For instance, you can press Ctrl+Space to set a new accept key. - Remove the old keybinding if needed
If the new key conflicts with another command, VS Code shows a warning. You can remove the conflicting keybinding by right-clicking the duplicate entry and selecting Remove Keybinding.
Method 2: Editing keybindings.json Directly
- Open keybindings.json
In the Keyboard Shortcuts view, click the Open Keyboard Shortcuts (JSON) button at the top right (an icon with curly braces). This opens thekeybindings.jsonfile. - Add a custom keybinding
Insert a new JSON object inside the array. Use the following template for accepting a suggestion with Ctrl+Space:{ "key": "ctrl+space", "command": "editor.action.inlineSuggest.commit", "when": "editorTextFocus && inlineSuggestionVisible" } - Use the correct when clause
Thewhenclause ensures the shortcut only works when an inline suggestion is visible. Without it, the key might trigger other actions. For dismissing, useeditor.action.inlineSuggest.hide. For cycling, useeditor.action.inlineSuggest.showNextandeditor.action.inlineSuggest.showPrev. - Save the file
Press Ctrl+S to save. The new keybinding takes effect immediately. Test it by triggering a Copilot suggestion and pressing your new key.
Common Mistakes and Limitations
The new hotkey does not work
If your custom key does nothing, check the when clause. The most common cause is missing the inlineSuggestionVisible condition. Copy the exact when clause from the default keybinding. Also verify that no other extension overrides the same key. Use the Keyboard Shortcuts view to search for conflicts.
Tab key still accepts suggestions even after remapping
VS Code allows multiple keys for the same command. If you want to remove the default Tab behavior, add a new keybinding that disables it. In keybindings.json, add: { "key": "tab", "command": "-editor.action.inlineSuggest.commit" }. The minus sign before the command name tells VS Code to remove that keybinding. This does not affect Tab for indentation because the when clause only applies when a suggestion is visible.
Copilot shows no inline suggestions
If Copilot stops showing suggestions after changing hotkeys, check that the Copilot extension is enabled and signed in. The hotkey change itself does not disable suggestions. Restart VS Code and verify that the status bar shows the Copilot icon with a checkmark. If suggestions still do not appear, open the Output panel and select “Copilot” from the dropdown to see error logs.
Default Hotkeys vs Custom Hotkeys for Inline Suggestions
| Action | Default Hotkey | Custom Example |
|---|---|---|
| Accept suggestion | Tab or Enter | Ctrl+Space |
| Dismiss suggestion | Escape | Ctrl+Shift+Space |
| Show next suggestion | Alt+] | Ctrl+Down |
| Show previous suggestion | Alt+[ | Ctrl+Up |
You can now assign any keyboard shortcut to accept, dismiss, or cycle through GitHub Copilot inline suggestions in VS Code. Use the Keyboard Shortcuts editor for simple changes or edit keybindings.json for full control. After changing a hotkey, test it immediately by triggering a suggestion. To avoid conflicts, always include the when clause editorTextFocus && inlineSuggestionVisible in your JSON entries. For advanced customization, you can also remap the Tab key to a different action like editor.action.triggerSuggest to trigger VS Code’s own suggestion list instead.