I like the use the German umlauts "ö", "Ö", "ä", and "Ä" on my keyboard for coding in VSCode, i.e., use these keys to type square and curly brackets. Here is what I tried in keybindings.json
:
{ "key": "ö", "command": "type", "args": { "text": "[" }, "when": "editorTextFocus" },
{ "key": "ä", "command": "type", "args": { "text": "]" }, "when": "editorTextFocus" },
{ "key": "Shift+ö", "command": "type", "args": { "text": "{" }, "when": "editorTextFocus" },
{ "key": "Shift+ä", "command": "type", "args": { "text": "}" }, "when": "editorTextFocus" },
{ "key": "Alt-ö", "command": "type", "args": { "text": "ö" }, "when": "editorTextFocus" },
{ "key": "Alt-ä", "command": "type", "args": { "text": "ä" }, "when": "editorTextFocus" },
{ "key": "Alt-Shift+ö", "command": "type", "args": { "text": "Ö" }, "when": "editorTextFocus" },
{ "key": "Alt-Shift+ä", "command": "type", "args": { "text": "Ä" }, "when": "editorTextFocus" }
VSCode complains:
You won't be able to produce this key combination under your current keyboard layout.
Is there an easy way to teach VSCode to allow bindings for any key instead of just the predefined ones?
Thanks @Gama11 for the hint regarding the UI. I tried it and got the keys [Semicolon]
, [Quote]
, and [BracketLeft]
, for ö
, ä
, and ü
for my German keyboard + layout.
Here is my working keybindings.json
:
{ "key": "[Semicolon]", "command": "type", "args": { "text": "[" }, "when": "editorTextFocus" },
{ "key": "[Quote]", "command": "type", "args": { "text": "]" }, "when": "editorTextFocus" },
{ "key": "Shift+[Semicolon]", "command": "type", "args": { "text": "{" }, "when": "editorTextFocus" },
{ "key": "Shift+[Quote]", "command": "type", "args": { "text": "}" }, "when": "editorTextFocus" },
{ "key": "Alt+[Semicolon]", "command": "type", "args": { "text": "ö" }, "when": "editorTextFocus" },
{ "key": "Alt+[Quote]", "command": "type", "args": { "text": "ä" }, "when": "editorTextFocus" },
{ "key": "Shift+Alt+[Semicolon]", "command": "type", "args": { "text": "Ö" }, "when": "editorTextFocus" },
{ "key": "Shift+Alt+[Quote]", "command": "type", "args": { "text": "Ä" }, "when": "editorTextFocus" }
It works perfectly for the mapped umlaut keys and does not interfere with the regular ;
and "
keys.