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.26.7):
// Place your key bindings in this file to override the defaults
[
/// ask mode
{
"key": "ctrl+enter",
"command": "workbench.action.chat.submit",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput && chatMode == 'ask' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatMode == 'ask' || chatInstructionsAttached && chatRequestIsPaused && inChatInput && chatMode == 'ask' || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress && chatMode == 'ask'"
},
{
"key": "enter",
"command": "-workbench.action.chat.submit",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput && chatMode == 'ask' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatMode == 'ask' || chatInstructionsAttached && chatRequestIsPaused && inChatInput && chatMode == 'ask' || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress && chatMode == 'ask'"
},
{
"key": "alt+enter",
"command": "workbench.action.chat.submitWithCodebase",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput || chatInputHasText && inChatInput && !chatSessionRequestInProgress || chatInstructionsAttached && chatRequestIsPaused && inChatInput || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress"
},
{
"key": "ctrl+enter",
"command": "-workbench.action.chat.submitWithCodebase",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput || chatInputHasText && inChatInput && !chatSessionRequestInProgress || chatInstructionsAttached && chatRequestIsPaused && inChatInput || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress"
},
/// edit & agent mode
{
"key": "enter",
"command": "-workbench.action.edits.submit",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput && chatMode != 'ask' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatMode != 'ask' || chatInstructionsAttached && chatRequestIsPaused && inChatInput && chatMode != 'ask' || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress && chatMode != 'ask'"
},
{
"key": "ctrl+enter",
"command": "workbench.action.edits.submit",
"when": "chatInputHasText && chatRequestIsPaused && inChatInput && chatMode != 'ask' || chatInputHasText && inChatInput && !chatSessionRequestInProgress && chatMode != 'ask' || chatInstructionsAttached && chatRequestIsPaused && inChatInput && chatMode != 'ask' || chatInstructionsAttached && inChatInput && !chatSessionRequestInProgress && chatMode != 'ask'"
},
]
Top comments (0)