How to use hjkl keys as arrow keys in contextual menus in Visual Studio Code?

时间:2018-07-24 10:01:02

标签: visual-studio-code vscodevim

I am using vscodevim extension with Visual Studio Code.

I would love to use hjkl keys as arrow keys in contextual menus, specially for the intellisense.

Any idea how to enable this option?

If vscodevim extension does not support this feature, which shortcut can be used to move the cursor within the contextual menu without touching the arrow keys?

3 个答案:

答案 0 :(得分:0)

尝试

{
  "key": "h",
  "command": "selectNextSuggestion",
  "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
}

{
  "key": "l",
  "command": "selectPrevSuggestion",
  "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
}

或您要使用的任何键。这些键绑定将遍历智能感知建议。

答案 1 :(得分:0)

将以下内容添加到您的VSCode keybindings.json文件中:

{
    "key": "ctrl+k",
    "command": "selectPrevSuggestion",
    "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
    "key": "ctrl+j",
    "command": "selectNextSuggestion",
    "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},

在上面的评论中,贷方@GibboK对此问题的回答link

答案 2 :(得分:0)

我一直在寻找一种方法来做到这一点(如 Vim 或 Neovim J/K/L/M),而无需安装任何扩展。我在github上找到了一个配置,here

只需复制并粘贴(带注释)到 VS Code 的 keybindings.json 文件中,右上角的图标或 here

您还可以使用 Jumpy 扩展来补充此配置 here