Skip to content

kvoon3/vscode-which-key-config-gen

Repository files navigation

Which Key Config GenVS Code

Visual Studio Marketplace Version Made with reactive-vscode

Generate vscode which-key config automatically

Usage

  1. enable vscode-whichkey-config-gen
  2. add a names field to your vim.normalModeKeyBindingsNonRecursive (generate which-key hint title)
  3. replace the keymap whichkey.show with whichKeyConfigGen.show

And then simply remove your old which-key configs

{
- "whichkey.bindings": [
-   {
-     "key": "c",
-     "type": "bindings",
-     "name": "Go to Change...",
-     "bindings": [
-       {
-         "key": "n",
-         "name": "Next Changes",
-         "type": "command",
-         "command": "workbench.action.editor.nextChange"
-       },
-       {
-         "key": "p",
-         "name": "Previous Changes",
-         "type": "command",
-         "command": "workbench.action.editor.previousChange"
-       }
-     ]
-   }
- ],
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      // I prefer use leader twice to avoid overlap with Vim keymap, and you can still use one leader
      "before": ["leader", "leader"],
      "commands": ["whichKeyConfigGen.show"]
    },
    {
      "before": ["leader", "c", "n"],
+     "names": ["Go to Change...", "Next Change"],
      "commands": ["workbench.action.editor.nextChange"]
    },
    {
      "before": ["leader", "c", "p"],
+     "names": ["Go to Change...", "Previous Change"],
      "commands": ["workbench.action.editor.previousChange"]
    }
  ]
}

Commands

Command Title
whichKeyConfigGen.show Which Key Config Generator: Show Menu
whichKeyConfigGen.updateConfig Which Key Config Generator: Update Config
whichKeyConfigGen.toggleEnable Which Key Config Generator: Toggle Enable

Configurations

Key Description Type Default
whichKeyConfigGen.enable Enable which-key config generator boolean true
whichKeyConfigGen.normalModeNonRecursiveKeybindings Generated code, do not modify array []
whichKeyConfigGen.visualModeNonRecursiveKeybindings Generated code, do not modify array []

License

MIT License © 2024 Kevin Kwong