79605040

Date: 2025-05-03 19:26:56
Score: 0.5
Natty:
Report link

Thre are two things you can do

Use "When" property in keybindings for constraints on when it needs to be active

I had a key binding to open seach files in vim but it did not work when there was no active editor. I tried to add it to the vscode keybindings but the problem is that when you add a key map that has a follow up like "space space" all key maps that start with space (<leader> ) will stop working.

So i did this to fix it:

{
    "key": "space space",
    "command": "workbench.action.quickOpen",
    "when": "activeEditorGroupEmpty"
}

Also kept the orignal vscode keymap:

{
      "before": [
        "<leader>",
        "<leader>",
      ],
      "commands": [
        "workbench.action.quickOpen",
      ]
}

Vim keybindings don't work in all states one is which when there is no open editor so I conditionaly constrained the keybding in vscode to only work when the vim one does not work

Define it in vim

If there is no conflict like above where i needed the key bidning to work even when no editor is open then just define it inside vim.

Reasons:
  • Blacklisted phrase (0.5): i need
  • Blacklisted phrase (1): did not work
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Samyar