Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to accept only the next word in GitHub Copilot suggestion?

I would like to be able to accept only the next word of a GitHub Copilot suggestion, instead of the full suggestion. Is there a way to do this?

like image 441
Jacob Stern Avatar asked Aug 31 '25 02:08

Jacob Stern


2 Answers

šŸ’ā€ā™‚ļø The default keyboard shortcut is now "Cmd/Ctrl + Right Arrow".

This is called "partially accepting suggestions". Read the official documentation for more info:
āž¤ Code completions with GitHub Copilot in VS Code


For custom keybindings, paste something like the following into the keybindings.json file (which you can find through the omnibox):

{
  "key": "shift+ctrl+right",
  "command": "editor.action.inlineSuggest.acceptNextWord",
  "when": "inlineSuggestionVisible && !editorReadonly"
}
like image 157
Amiratak88 Avatar answered Sep 02 '25 15:09

Amiratak88


This option exists in VSCode keyboard preferences, but is not enabled by default (though a default keybinding might be coming soon). To enable a shortcut to accept only the next word, in VS Code go to File -> Preferences -> KeyboardShortcuts -> type "acceptNextWord" -> click "+" -> enter your desired keyboard shortcut.

I set acceptNextWord to be alt + RightArrow to be analogous to Copilot's alt + ] and alt + [ for next suggestion and previous suggestion.

like image 27
Jacob Stern Avatar answered Sep 02 '25 15:09

Jacob Stern