You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support contributing different keybindings based on keyboard layout #1240
VSCode should ship out of the box with multiple keymaps (based on/optimized for each keyboard layout).
e.g. toggle line comment should be ctrl+7 on swiss keyboards, etc.
VSCode should detect at runtime the current system keyboard layout and employ different defaults, based on the keyboard layout.
Reacted by Tomasz Szulc, Nicola Iarocci, Alain BUFERNE, Alexandru Dima, Dirk Bäumer, Steven Vandeweghe, Gianfranco Reppucci, Marco Q, Daniel Robinson, Tekbr and 63 more
Andre Weinand (@weinand) yes I am on german keyboard layout (ibm) and interestingly when I type "Cmd++" into the keyboard widget, I see it prints Cmd+= for me. What does it print for you?
Benjamin Pasero (@bpasero) I'm on a Swiss German keyboard and I see "shift+cmd+=" and I know where the '=' comes from. On a US keyboard the '+' and the '=' are together on a key and since we only have KeyCode constants for the unshifted key, it is KeyCode.US_EQUAL.
Benjamin Pasero (@bpasero) restating my question from above: did Cmd++ work for you without changing the keybinding?
I think it's maybe time to revive this issue. A number of other issues have been merged into this one including a lot of issues about languages that depend on AltGr. Now AltGr is a technique that gives one or both Alt a special function of switching to a secondary keyboard layout group.
Polish for example depends on AltGr to to switch between naked characters and accented ones. Pressing Z gives you Z while pressing Alt+Z gives you Ż. Polish diacritics are not otherwise available as separate keys (long story short: there used to be a Polish typist keyboard layout and typewriters used it but we had to import computers with US keyboards because communism).
Now Alt+Z from the example above is currently mapped to "toggle word wrap". This means we can't type in Polish without remapping parts of the keyboard.
Patryk Zawadzki (@patrys) On mac we ship with 516 default keybindings. There are hundreds of possible keyboard layouts only on the mac and it is possible for people to customize them and create their own keyboard layouts.
It is difficult to find key combinations which are both easy enough to be remembered, easy enough to be ergonomically feasible and which work across a wide number of the keyboard layouts well.
The correct fix for your case is for VS Code to ship with Alt+Z as the keybinding for toggle word wrap for every keyboard layout except the Polish one, under which Alt+Z should be kept free such that Ż can be produced. So issue #50053 is indeed a duplicate of this issue.
-- Sorry for the English, I used Google Translator --
I know the team has put a lot of resources into the VSCode. So much that it has much prominence in Windows, OS X and Linux and in several languages and not only in English.
And because of this dimension, I think you can already pay attention to Keyboard Layout for a variety of languages. Regardless of the number of votes. As I see it is a trivial resource. It already has a lot of other cases related precisely because of this problem.
It is very bad you look for a certain type of shortcut (which is in US standard) and when using in your layout (in my case PT-BR2) it does not match or be seen otherwise.
This affects both the VSCode and the extensions used in it.
But I want to congratulate the team for their great work.
It is possible to find the key bindings under
File, Preferences, Keyboard shortcuts.
What is annoying is that Help, Keyboard Shortcuts Reference points to a pdf that has no relation to the actual key bindings. Keybindings depend on the language. The PDF should state its specific validity for US American Keyboard layout.
I have a small programable keyboard that uses BootMapper Client to setup keybinds. It's configured to send the normal extra "F" keys tradicional keyboards don't have like F20, 21, 22, 23, 24, which are all valid keys.
For some reason VSCode does not detect these keys (but any other software does)
If I try to use the F20 key, what I get is an "unknown"
Using the debugger, I get this:
On the Mac using the option key, without the command key is problematic as it prevents the use of the alternative characters, that are only accessible when holding down the option key.
Using the control key is probably less bad, but it should be noted that certain combinations, such as ctrl-A, correspond to emacs style keyboard navigation that works in all text fields.
For example, I use a US keyboard, but being in a multilingual environment will sometimes needs to add an accent. These accents are available via the option key. The full range of characters available can be seen via the virtual keyboard. My workaround is to not use VS Code when I need to write things that need the full keyboard, since remapping all the VS Code short cuts is just too tedious.
This could be solved if VSCode had an option to interpret characters as valid shortkeys, just like editors like VIM, Helix, Zed and so on.
For instance, VSCode (on Windows at least) interprets AltGr as Ctrl+Alt. So any layout using AltGr+[key] to produce a special character could conflict with the shortkey Ctrl+Alt+[key] instead of outputting the desired char.
The workaround is to create a layout that replaces AltGr with Kana. I linked Kana to OEM_8 with KbdEdit. Now Kana+[key] will output the desired character without conflict. But it is impossible to use this character as a shortkey.
For instance, in my layout, I have Kana+F to output /. Here is how this is interpreted by VSCode:
Please, add an option to detect key as keybinding when it is identified.
This would make life so much easier for so many users who rely on custom or specific keyboard layouts, or Kanata, which sends characters via its Unicode function that are also detected by VSCode as a key.
It is a pain to have to use other keybindings on VSCode because of this when switching with other editors constantly.
Activity
bpasero commentedon Dec 14, 2015
Hm it should be...
bpasero commentedon Dec 14, 2015
So Cmd++ works for me, which is cool. However what is weird is that we set the keybinding like this:
{ primary: KeyMod.CtrlCmd | KeyCode.US_EQUAL }I could not find KeyCode.US_PLUS.
alexandrudima can you comment on this maybe?
weinand commentedon Dec 14, 2015
Benjamin Pasero (@bpasero) does Cmd++ work for you on a non-US keyboard?
bpasero commentedon Dec 14, 2015
Andre Weinand (@weinand) yes I am on german keyboard layout (ibm) and interestingly when I type "Cmd++" into the keyboard widget, I see it prints Cmd+= for me. What does it print for you?
weinand commentedon Dec 14, 2015
Benjamin Pasero (@bpasero) I'm on a Swiss German keyboard and I see "shift+cmd+=" and I know where the '=' comes from. On a US keyboard the '+' and the '=' are together on a key and since we only have KeyCode constants for the unshifted key, it is KeyCode.US_EQUAL.
Benjamin Pasero (@bpasero) restating my question from above: did Cmd++ work for you without changing the keybinding?
10 remaining items
patrys commentedon Sep 11, 2018
I think it's maybe time to revive this issue. A number of other issues have been merged into this one including a lot of issues about languages that depend on AltGr. Now AltGr is a technique that gives one or both Alt a special function of switching to a secondary keyboard layout group.
Polish for example depends on AltGr to to switch between naked characters and accented ones. Pressing Z gives you
Zwhile pressing Alt+Z gives youŻ. Polish diacritics are not otherwise available as separate keys (long story short: there used to be a Polish typist keyboard layout and typewriters used it but we had to import computers with US keyboards because communism).Now Alt+Z from the example above is currently mapped to "toggle word wrap". This means we can't type in Polish without remapping parts of the keyboard.
alexdima commentedon Sep 12, 2018
Patryk Zawadzki (@patrys) On mac we ship with 516 default keybindings. There are hundreds of possible keyboard layouts only on the mac and it is possible for people to customize them and create their own keyboard layouts.
It is difficult to find key combinations which are both easy enough to be remembered, easy enough to be ergonomically feasible and which work across a wide number of the keyboard layouts well.
The correct fix for your case is for VS Code to ship with Alt+Z as the keybinding for toggle word wrap for every keyboard layout except the Polish one, under which Alt+Z should be kept free such that
Żcan be produced. So issue #50053 is indeed a duplicate of this issue.Tekbr commentedon Sep 19, 2018
-- Sorry for the English, I used Google Translator --
I know the team has put a lot of resources into the VSCode. So much that it has much prominence in Windows, OS X and Linux and in several languages and not only in English.
And because of this dimension, I think you can already pay attention to Keyboard Layout for a variety of languages. Regardless of the number of votes. As I see it is a trivial resource. It already has a lot of other cases related precisely because of this problem.
It is very bad you look for a certain type of shortcut (which is in US standard) and when using in your layout (in my case PT-BR2) it does not match or be seen otherwise.
This affects both the VSCode and the extensions used in it.
But I want to congratulate the team for their great work.
Thanks for the attention.
// ping alexandrudima
jrpub commentedon Mar 11, 2019
Refering to #32473 (which has been closed), to open terminal on many french laptops:
ctrl + ù
Sorry if it has been already disclosed, I didn't read everything, just wanted to put the tips.
kingma-sbw commentedon Feb 24, 2020
It is possible to find the key bindings under
File, Preferences, Keyboard shortcuts.
What is annoying is that Help, Keyboard Shortcuts Reference points to a pdf that has no relation to the actual key bindings. Keybindings depend on the language. The PDF should state its specific validity for US American Keyboard layout.
fleps commentedon Mar 18, 2021
I have a small programable keyboard that uses BootMapper Client to setup keybinds. It's configured to send the normal extra "F" keys tradicional keyboards don't have like F20, 21, 22, 23, 24, which are all valid keys.
For some reason VSCode does not detect these keys (but any other software does)
If I try to use the F20 key, what I get is an "unknown"
Using the debugger, I get this:
/ Received keydown event - modifiers: [], code: F20, keyCode: 131, key: F20
| Converted keydown event - modifiers: [], code: F20, keyCode: 0 ('unknown')
\ Keyboard event cannot be dispatched in keydown phase.
If I use other keys like F12, this doesn't happen, even if I program the F12 to come from the macro keyboard.
Why VSCode just don't use the KeyCode? Why does it need to "convert" it??
It seems we had a setting in the past that fixed this on Windows ( "keyboard.dispatch": "keyCode" ) but now this setting is not valid anymore.
Again, why? Why overcomplicate such a simple thing for valid keyCodes that exist since forever?
Lemmingh commentedon Sep 24, 2021
Lemmingh commentedon Sep 24, 2021
I guess I get your idea now. The "F20" case seems to be an issue from Chrome.
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
Line 619 in 7122249
ajmas commentedon Oct 19, 2021
On the Mac using the option key, without the command key is problematic as it prevents the use of the alternative characters, that are only accessible when holding down the option key.
Using the control key is probably less bad, but it should be noted that certain combinations, such as ctrl-A, correspond to emacs style keyboard navigation that works in all text fields.
For example, I use a US keyboard, but being in a multilingual environment will sometimes needs to add an accent. These accents are available via the option key. The full range of characters available can be seen via the virtual keyboard. My workaround is to not use VS Code when I need to write things that need the full keyboard, since remapping all the VS Code short cuts is just too tedious.
Fred-Vatin commentedon Jul 29, 2026
This could be solved if VSCode had an option to interpret characters as valid shortkeys, just like editors like VIM, Helix, Zed and so on.
For instance, VSCode (on Windows at least) interprets
AltGrasCtrl+Alt. So any layout usingAltGr+[key]to produce a special character could conflict with the shortkeyCtrl+Alt+[key]instead of outputting the desired char.The workaround is to create a layout that replaces
AltGrwithKana. I linkedKanatoOEM_8with KbdEdit. NowKana+[key]will output the desired character without conflict. But it is impossible to use this character as a shortkey.For instance, in my layout, I have
Kana+Fto output/. Here is how this is interpreted by VSCode:Please, add an option to detect
keyas keybinding when it is identified.This would make life so much easier for so many users who rely on custom or specific keyboard layouts, or Kanata, which sends characters via its
Unicodefunction that are also detected by VSCode as akey.It is a pain to have to use other keybindings on VSCode because of this when switching with other editors constantly.