vercel/hyper

Not possible to map multiple keybinds to the same command in Hyper

开放

#2,233 创建于 2017年9月19日

 (11 条评论) (0 个反应) (0 位负责人)TypeScript (3,558 个派生)batch import
help wanted🎨 Type: Enhancement

仓库指标

星标
 (44,582 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

  • I am on the latest Hyper.app version
  • I have searched the issues of this repo and believe that this is not a duplicate

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!

贡献者指南