Hyper Key Vim-style navigation with Karabiner Elements

[Tweet]

Now that I have my Hyper key working with Karabiner Elements, there’s one other feature I’ve been missing from the old setup: I used to be able to hold the s and d simultaneously to turn h, j, k, and l into vim navigation keys (←, ↑, ↓, →). That kind of simultaneous keypress mapping isn’t currently possible in the Sierra version of Karabiner, so I created a new solution.

If you already have the Hyper key set up (turning Caps Lock into command-control-option-shift), this solution will let Hyper+h/j/k/l work as Vim navigation, and holding Caps Lock and Tab together will make them function as home, page up, page down, and end. I also added forward delete to Hyper+x, but mostly because I’ve been using a Matias Laptop Pro keyboard and it doesn’t have a convenient one built in.

There’s an example setup provided with Karabiner Elements for doing similar with the Spacebar. I found this untenable because it was too easy to get an accidental simultaneous keystroke when typing, and I started missing letters. The Hyper key is one that I don’t press while typing quickly.

The Tab key as fn modification that makes the ↖/↘/⇞/⇟ keys work can suffer the same issue, but it’s less likely I’ll have accidental simultaneous keystrokes. It’s worked fine thus far with the default basic.to_if_alone_timeout_milliseconds setting of 1000. As a bonus, Tab works as Fn any time it’s held while hitting another key, so you can use it as a function key modifier with any combination. I use my function row as function keys, so I have to hold function to use things like the volume keys, and having that at my pinky is pretty handy.

I set up an installable rule that you can add by clicking this button (assuming you have Karabiner Elements installed):

Hyper Vim Nav

Clicking “Import” will add three rules to the Complex Modifications tab of Karabiner Elements. Click “Add rule” and then enable all of the rules under the “Hyper key vim navigation” section. You’ll have to do it one at a time, clicking “Add rule” each time. They’re separated so that if you don’t need the ⇞/⇟ functionality, you can skip that as well as the “Tab as fn” rule.

For a more manual approach, my current karabiner.json file is available in a gist. Following that link will show it with the Vim navigation settings highlighted. If you’ve done any customization at all, be careful not to overwrite it when editing.