If your hit "Enter", the prompt is sent. However, for Copilot better understanding a longer prompt, it is good to use new lines to separate paragraphs. I hope, by default, hitting "Enter" means "new line" instead of "Send prompt".
TL;DR
WARNING: GitHub Copilot Chat plugin still hasn't reached stable, so the solutions below would out of date quickly, especially the GUI one. Follow it with your own understanding.
Option 1: Using GUI
- VS Code -> File -> Preferences -> Keyboard Shortcuts
- Search
workbench.action.chat.submit
, change it toCtrl + Enter
or anything you like. - Search
workbench.action.chat.submitSecondaryAgent
, change it toCtrl + Alt + Enter
or anything you like.
The result in "Keyboard Shortcuts" page:
The result in GUI:
Option 2: Using keybindings.json
(This method could not override existing keybindings)
- Open the Command Palette in Visual Studio Code by pressing
Cmd+Shift+P
on your Mac. - Type
Preferences: Open Keyboard Shortcuts (JSON)
and select it.
Add the following JSON configuration to the keybindings.json
file (GitHub Copilot Chat v0.23.1):
// Place your key bindings in this file to override the defaults
[
// Add new keybindings
{
"key": "ctrl+enter",
"command": "workbench.action.chat.submit",
"when": "chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatLocation != 'editing-session'"
},
// remove default keybindings
// without these, the default keybindings will still work
{
"key": "enter",
"command": "-workbench.action.chat.submit",
"when": "chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatLocation != 'editing-session'"
}
]
(GitHub Copilot Chat v0.22.2):
// Place your key bindings in this file to override the defaults
[
// Add new keybindings
{
"key": "ctrl+enter",
"command": "workbench.action.chat.submit",
"when": "chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatLocation != 'editing-session' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && !isApplyingChatEdits && chatLocation == 'editing-session'"
},
{
"key": "ctrl+alt+enter",
"command": "workbench.action.chat.submitSecondaryAgent",
"when": "chatInputHasText && inChatInput && !chatInputHasAgent && !chatSessionRequestInProgress"
},
// remove default keybindings
// without these, the default keybindings will still work
{
"key": "enter",
"command": "-workbench.action.chat.submit",
"when": "chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatLocation != 'editing-session' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && !isApplyingChatEdits && chatLocation == 'editing-session'"
},
{
"key": "ctrl+enter",
"command": "-workbench.action.chat.submitSecondaryAgent",
"when": "chatInputHasText && inChatInput && !chatInputHasAgent && !chatSessionRequestInProgress"
}
]
Top comments (0)