This page discusses issues and suggestions for setting up GitHub Copilot together with other popular Visual Studio Code extensions.
GitHub Copilot's inline suggestions are triggered when typing or moving with the arrow keys, but not when moving in Vim's Command mode, and then dropping into Insert mode.
A possible work-around is to install the macros
package, and then setup macros
that execute the desired Vim command followed by triggering the inline
suggestions.
For example, to trigger GitHub copilot after any of o
, O
and A
, put the following in your settings.json
:
"macros": {
"vimShiftA": [
"cursorLineEnd",
"extension.vim_insert",
"editor.action.inlineSuggest.trigger"
],
"openLineBelow": [
"editor.action.insertLineAfter",
"extension.vim_insert",
"editor.action.inlineSuggest.trigger"
],
"openLineAbove": [
"editor.action.insertLineBefore",
"extension.vim_insert",
"editor.action.inlineSuggest.trigger"
],
}
and the following in your keybindings.json
:
{
"key": "shift+A",
"command": "macros.vimShiftA",
"when": "editorFocus && vim.active && !inDebugRepl && vim.mode == 'Normal'"
},
{
"key": "o",
"command": "macros.openLineBelow",
"when": "editorFocus && vim.active && !inDebugRepl && vim.mode == 'Normal'"
},
{
"key": "shift+o",
"command": "macros.openLineAbove",
"when": "editorFocus && vim.active && !inDebugRepl && vim.mode == 'Normal'"
}