zed
zed copied to clipboard
Custom keyboard shortcuts not working with non-default keyboard layouts on MacOS
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Case 1:
- Activate the "Toggle Base Keymap Selector" and select "JetBrains."
- Open "keymap.json" in the editor, for example.
- Set your system keyboard layout to a national layout, e.g., Ukrainian.
- Place the cursor on any "cmd" string and press ctrl-g.
Expected Result: The "cmd" under the cursor is selected, and subsequently, every next "cmd" in the file is selected one by one.
Actual Result: The "go to line" action is triggered.
Case 2:
- Add custom bindings in "keymap.json," e.g.:
"cmd-a": null,
"cmd-a p": "projects::OpenRecent",
- Set your system keyboard layout to the Ukrainian layout.
- Press the keys in the sequence "cmd-a p."
Expected Result: The "Open Recent Projects" action is triggered.
Actual Result: The "з" symbol is entered.
The sequence "cmd-a cmd-p" works fine. However, neither "cmd-a ctrl-p", "cmd-a alt-p", nor "cmd-a p" work.
Environment
Zed: v0.132.2 (Zed) OS: macOS 14.4.1 Memory: 64 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log
file to this issue.
No response
I found #10953 to be similar to this issue, because the video shows a "HU" layout.
I found #10953 to be similar to this issue, because the video shows a "HU" layout.
Changing my keyboard layout to US
or ABC
doesn't solve the issue with ctrl-h
in particular on my end.
Do your overrides start working if you switch your layout?
Yes, my overrides work fine when I switch to the ABC layout.
I have also tried the QZ layout (the German QWERTZ, where Y and Z are swapped), and my overrides still work well.
However, when I tried Cmd+Z, it appears to be activated by my physical Cmd+Y. I wonder if this is common for German users. At least on my system in Safari, it works the same way. Meanwhile, for Ukrainian and Russian layouts, it is common to use standard "physical" English keys for shortcuts.
This complicates universal support for national standards, as it requires conducting extensive research. Perhaps in this case, it would be simpler to initially provide an option to 'use the default layout for shortcuts,' to at least solve the problem for some users.
ChatGPT suggests that in some versions of macOS, it is possible to set a system-wide option to use the same keyboard layout for shortcuts, which maintains shortcut consistency across different language layouts. However, in the latest version of macOS, I was unable to find this option, so I cannot try it out and share how it works.
Having the same issue on linux with wayland compositor. Here is my issue https://github.com/zed-industries/zed/issues/12329
+1
I found some interesting behaviour on a german QWERTZ Layout on Linux (Wayland & X11)
On a german QWERTZ layout the forward slash (/) is on (shift-7) and the ampersand (&) is on (shift-6)
I tried to make the "editor::ToggleComments" comand to work as expected, which would be (ctrl-shift-7) on VSCode with a german layout. I got it working by setting:
{
"ctrl-shift-/": ["editor::ToggleComments", { "advance_downwards": false }]
}
"ctrl-shift-7"
and "ctrl-/"
did not work.
But when i try it with the ampersand, i have to set:
{
"ctrl-&": ["editor::ToggleComments", { "advance_downwards": false }]
}
"ctrl-shift-6"
and "ctrl-shift-&"
did not work.
Why is there a difference so that pressing ctrl + amp (ctrl-shift-6) got interpreted as (ctrl-&) but pressing ctrl + forward slash (ctrl-shift-7) got interpred as (ctrl-shift-/)?
I think the difference in the interpretation is the reason why this keybinding (and many more) don't work out of the box on german layouts. It seams that some special keys require the shift keyword in their bindings and other do not, no matter they all acctually need shift to be pressed on a QWERTZ Layout.
Is there any plan to implement a visual keybinding editor or a keybinging tester (where i can press a key combo and get the interpreted result back)?
In VSCode i actually have to set "ctrl-shift-6"
or "ctrl-shift-7"
in the config. This does not mean "you should do it like VSCode" but i found it interessting that there seams to be quite a difference in interpreting keystrokes.
I think which ever way Zed goes it should be consistent. Right now i have to guess and try multiple keybindings out a QWERTZ layout.
A similar issue happens for spanish layout with keys with characters that are not 'final' like ´ `, where the key is not recognized.
This should be the keymap for indent/outdent to match my other editors:
[
{
"context": "Editor",
"bindings": {
"alt-cmd-`": "editor::Outdent", // doesn't work
"alt-cmd-+": "editor::Indent", // works
}
}
]
So, any fixes for that?
On my Ukrainian/russian layout even ctrl+c abs ctrl*v don't work