如何让 vim 用户快捷方式在 vscode 中工作

How do I get vim user Shortcuts to work in vscode

vscode > 首选项:打开设置 (JSON)

{
“vim.normalModeKeyBindingsNonRecursive”:[

    {
        "before": ["t", "s"],
        "commands": ["python.sortImports"],
    }
]

}

我按上面设置了,但是不行。有什么问题吗? 我在 vim-正常模式下输入 't' 和 's'。 ctrl+alt+s 正在工作。但我想要自定义 vim 快捷方式

尝试重新安装 vim extension。如果失败,您可以尝试以下操作:

  1. Are your configurations correct?

Adjust the extension's logging level to 'debug', restart VS Code. As each > remapped configuration is loaded, it is outputted to console. In the Developer > Tools console, do you see any errors?

debug: Remapper: normalModeKeyBindingsNonRecursive. before=0. after=^.
debug: Remapper: insertModeKeyBindings. before=j,j. after=<Esc>.
error: Remapper: insertModeKeyBindings. Invalid configuration. Missing 'after' key or 'command'. before=j,k.

Misconfigured configurations are ignored.

  1. Does the extension handle the keys you are trying to remap?

VSCodeVim explicitly instructs VS Code which key events we care about through > the package.json. If the key you are trying to remap is a key in which vim/vscodevim generally does not handle, then it's most likely that this extension does not receive those key events from VS Code. With logging level adjusted to 'debug', as you press keys, you should see output similar to:

debug: ModeHandler: handling key=A.
debug: ModeHandler: handling key=l.
debug: ModeHandler: handling key=<BS>.
debug: ModeHandler: handling key=<C-a>.

As you press the key that you are trying to remap, do you see it outputted here? If not, it means we don't subscribe to those key events. It is still possible to remap those keys by using VSCode's keybindings.json.

来源:https://marketplace.visualstudio.com/items?itemName=vscodevim.vim#debugging-remappings