Not possible to map multiple keybinds to the same command in Hyper
#2233 opened on Sep 19, 2017
Description
- I am on the latest Hyper.app version
- I have searched the issues of this repo and believe that this is not a duplicate
- OS version and name: macOS Sierra 10.12.6
- Hyper.app version: Hyper 1.4.6 (stable)
- Link of a Gist with the contents of your .hyper.js: https://gist.github.com/lewisl9029/44f4f3c23bb310fb0035f013f7156fb2
- Relevant information from devtools (CMD+ALT+I on Mac OS, CTRL+SHIFT+I elsewhere): N/A
- The issue is reproducible in vanilla Hyper.app:
Is Vanilla
Issue
I was trying to remap both ctrl+e and cmd+e to pane splitting to allow my config to be sync'ed as-is between my Windows and Mac environments, but found out this wasn't possible in Hyper because the Hyper keymap format maps from commands to keybinds as opposed to from keybinds to commands, like in editors like Atom or VSCode:
Hyper:
// Only `cmd+e` here takes effect because a JS Object can't have duplicate keys.
'pane:splitHorizontal': 'ctrl+e',
'pane:splitHorizontal': 'cmd+e',
Atom:
// Both `cmd-e` and `ctrl-e` will be mapped to the same command.
'cmd-e': 'pane:split-right-and-copy-active-item'
'ctrl-e': 'pane:split-right-and-copy-active-item'
The Atom keymap structure seems to make much more sense to me, because mapping multiple keybinds to the same command seems like a much more useful and common use case than mapping multiple commands to the same key (in fact, I would go as far as to consider the fact that we're able to do this in Hyper to be a bug, because of all the confusing behavior this could lead to).
Any particular reason why we're mapping commands to keybinds instead of the other way around in Hyper? If not, would you consider accepting a PR to invert this mapping? I'd totally understand if you'd rather hold off on changing the keymap structure since it'll break people's configs. If anyone has any ideas on how to implement this change in a backwards compatible way, I'd love to hear them. Thanks!