简体   繁体   中英

vscode global keyboard shortcuts overriding in extension

I have a set of keybindings in package.json ,

{
     "command": "md.image",
     "key": "Ctrl+Shift+i"
}, {
    "command": "md.codeblocks",
    "key": "Ctrl+Shift+B"
}

This has a problem with other global keyboard shortcuts in vscode, I want to have this overridden in the extension so these keyboards act as the current keyboard mappings for the language its loaded for.

Is this possible?

In case anyone runs into the same specific example of this that I ran into:

I was trying to use the Ctrl + F command to go forward with the Vim extension in VS Code.

I tried unsuccessfully putting a config with unset! in keybindings.json .

However I found that "vim.useCtrlKeys": true in settings.json allows these sorts of ctrl keys to work in the Vim extension with no other changes necessary.

You can disable existing shortcuts by adding a keybinding entry and prefixing its command with a - . For example, to disable the builtin global shortcut for ctrl+n , add the following entry:

{ "key": "ctrl+n", "command": "-cursorDown", "when": "textInputFocus" }

You can find the default global entries by selecting "Preferences: Open Default Keyboard Shortcuts (JSON)" from the Command Palette.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM