Karabiner & Goku: Next step is Hyper mode (Mac)

In a earlier post, I setup Karabiner with Goku to map Cmd-Ctrl-w to a series of custom keystrokes.

Why not make this even easier?

Enter “hyper” mode, which is the idea of making ANY key on your keyboard act like the Ctrl key. Basically, this is making a regular key like the “a” key a modifier key (a key to be held-down), but a regular “a” when the key is typed normally.

Based on @nikitavoloboev’s karabiner.edn file, I started with a very small config and now slowly adding more keyboard shortcuts/macros.

Here’s a simple ~/.config/karabiner.edn that makes the ‘a’ key behave like a SHIFT key, but only for the letter ‘y’. And, if you hold-down ‘a’ and tap ‘h’, it types out “Hi”:

{
  :simlayers {
    :a-mode {:key :a}
  }
  :main [{:des "a-key (launch apps, for example)"
    :rules [:a-mode
      [:y :!Sy]
      [:h [:!Sh :i]]
    ]
  }]
}

Don’t forget, to make it active (update karabiner.json) by running Goku. Or use ‘gokuw’, which will always watch for changes to your karabiner.edn:
$ goku

This means, the “a” key, used as a modifier key, can be mapped to another 40+ other keys to do 40 more custom keystrokes.
Then the “b” key in the same way, can give you another 40 more custom keystrokes.
Then the “c” key… and so on.
Even the SPACEBAR can be turned into a modifier key!

That’s a lot of new keyboard shortcuts.

When you want to add another modifier to karabiner.edn (a new “layer”), do something like this:

{
  :simlayers {
    :a-mode {:key :a}
    :d-mode {:key :d}
  }
  :main [
    {:des "a-key (stuff for vim)"
      :rules [:a-mode
          ;; complete a ctag
          [:y [:!Tx :!Tclose_bracket]]

          ;; c-x, c-p complete prev word
          [:u [:!Tx :!Tp]]

          ;; c-x, c-l complete whole line
          [:i [:!Tx :!Tl]]
      ]
    }
    {:des "d-key (dpkg)"
      :rules [:d-mode
        [:y :!Sy]
        [:p [:d :p :k :g :spacebar :hyphen :l]]
      ]
    }
  ]
}

Refs:
https://medium.com/@nikitavoloboev/karabiner-god-mode-7407a5ddc8f6