config: fix physical -> unicode keybinds for alternate keyboard layouts #9469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dvorak input (and presumably others) on MacOS causes certain keys to not work as expected:
[]and=.Related
This fixes #8743 as well as an unmentioned problem where bracket navigation and equalize panes are also broken.
This is similar to #8759 but fixes more of the combos. Switching the
+binding was not enough to fix the problem for me since the right bracket physical keys is where equals should be and overrides the combo.What this PR does
Switches several default keybindings from physical key codes
.physical = .equal // or .bracket_left or .bracket_rightto.unicode = '=' // or '[' or ']'to support alternative keyboard layouts like Dvorak and keyboards with dedicated plus keys.
Details
In testing, I found that all of these bindings need to be fixed otherwise the bracket physical keys overshadows the dvorak plus key.
This seems like the right solution for the same reason that we don't use any physical letter or number keys. They move around with different layouts and
=,[, and]are no different than other keys like-and0which use unicode in other default keybinds.With this fix, tab and pane navigation (cmd+[], cmd+shift+[]), as well as increase font size (cmd+shift+equals and cmd+equals) and equalize panes (ctrl+cmd+=) now work as expected on dvoark layout on MacOS.
Note, I switch between dvorak virtual layout on the laptop and a physical dvorak keyboard (passed through qwerty input) so my combos would need to change depending on which keyboard I was using if we used physical keys only.
I consulted Claude Code to help try to understand what order and precedence was being applied in this change, but I wrote and tested the code myself (however, this is my first
zigcode so take that with a grain of salt).