I use VSCode with the Vim extension and I want to navigate the QuickFix menu using Ctrl+j and Ctrl+k keyboard shortcuts. How can I do that?
How can I set keyboard shortcuts for selecting suggestions in the VSCode QuickFix menu?
874 Views Asked by Vitaliy Vostrikov At
2
There are 2 best solutions below
0

As of VSCode version 1.87.2 (and likely earlier versions), this is possible. You need to edit the keybindings.json
file to include the following within the list.
{
"key": "ctrl+j",
"command": "selectNextCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+down",
"command": "selectNextCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+k",
"command": "selectPrevCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+up",
"command": "selectPrevCodeAction",
"when": "codeActionMenuVisible"
},
The screenshot above does not make it clear which language you are using but it definitely works with for C++ and Rust using the plugins indicated below.
I think that isn't possible because VS code uses native menu to show Quick Fix suggestions, according to this.
There is an extension attempted to work around this by showing the suggestions on quick open instead of native menu so we can navigate through the suggestion using shortcut we usually use on quick open. Although, I can't get the extension work on my Flutter project.
Despite the fact that we can't navigate up and down, we can navigate the menu by typing the first letter of the one of the suggestions. In your example, we can select the
Wrap with widget
menu by pressingw
, then we can go toWrap with Center
by pressingw
again. Pressingw
will cycle through menu that starts withw
. I got this working on Ubuntu 20.04 but I don't know if this works on other OSes.