hammerspoon 可以用分号做修饰键吗

看到 abo-abo 用

  • ;-a instead of -.
  • ;-s instead of Shift–.
  • ;-q instead of Shift-’.

windows上用ahk很容易实现。 最近切换到来macos,用 hammerspoon 感觉并不能任意用一个键做修饰符号用啊?

好像是的,karabinder可能可以。hammerspoon作者说过karabinder比hammerspoon更接近底层。

楼主说的abo-abo的做法有链接吗?这几个设置在emacs里也生效还是只在其它软件里用?


回答问题:

~/.config/karabiner/assets/complex_modifications/shift-to-paren.json

{
  "title": "Change shift key",
  "rules": [
    {
      "description": "Change shift to () if alone.",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "left_shift",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_shift"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "9",
              "modifiers": [
                "left_shift"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_shift"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "0",
              "modifiers": [
                "left_shift"
              ]
            }
          ]
        }
      ]
    }
  ]
}

1 个赞

参考vim.lua, 用 hs.hotkey.modal ,然后把分号绑定到 按下进入模式,up退出模式。

2 个赞