vscode > Preferences: Open Settings (JSON)
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["t", "s"],
"commands": ["python.sortImports"],
}
]
}
I set it up as above, but it doesn't work. What could be wrong? I'm typing 't' and 's' in vim-normal mode. ctrl alt s is woring. but i wanna have custom vim shortcuts
CodePudding user response:
Try reinstalling the vim extension. If this fails, you could try the following:
- 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.
- 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.
Source: https://marketplace.visualstudio.com/items?itemName=vscodevim.vim#debugging-remappings