在 VSCode 中更改德语变音符号的键绑定

Change key binding for German umlauts in VSCode

我喜欢在 VSCode 中使用键盘上的德语变音符号“ö”、“Ö”、“ä”和“Ä”进行编码,即使用这些键来键入方形和卷曲括号。这是我在 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抱怨:

You won't be able to produce this key combination under your current keyboard layout.

有没有简单的方法教 VSCode 允许绑定任何键而不仅仅是预定义的键?

这些是允许的,pre-defined "Toggle Integrated Terminal" 快捷键毕竟是 Ctrl+ö。你不能在 JSON.

中按字面意思写字符

我自己通常也更喜欢使用 JSON 编辑器,但这实际上是 UI 非常有用的情况。在 "please enter desired key combination" 弹出窗口中,您可以看到使用 QWERTZ 键盘...

  • ...ö 变为 oem_3
  • ...ä 变为 oem_7
  • ...ü 变为 oem_1

感谢@Gama11 关于 UI 的提示。我尝试了它,并为我的德语键盘获得了 [Semicolon][Quote][BracketLeft] 键,以及 öäü +布局。

这是我的作品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" }  

它非常适合映射的变音键,不会干扰常规的 ;" 键。