Karabiner is an absolutely amazing app that lets you remap keys at a very low level on macOS.
For example you can make caps lock into an escape key when pressed once but if you do hold it, it becomes a hyper key. Hyper key means that a key now serves two purposes, once when pressed alone and once when held down. So for example for remapping caps lock, we can remap it to act as escape when pressed alone once but if we hold down on it it becomes ⌘ + ⌃ modifier key. So
caps lock + F becomes ⌘ + ⌃ + F. And so on.
I however take this idea further and define these kind of hyper keys but for every single key on my keyboard. I like to call them sticky keys and you can read more about it here.
My personal Karabiner setup
I share my Karabiner private.xml here. It is approximately 12,000 lines long so might take a bit of time to load. However I edit it in vim and vim handles this big file very easily. I also use
_ to indicate jumping points in the config. So I can jump between various XML blocks by searching
_km def for defining KM actions to map,
_alfred def for mapping alfred triggers to run and
sticky .. to jump between sticky key definitions.
- I can embed simultaneous key mappings inside sticky key definitions.