Vim keys for window management on a Mac

Updated · by , maker of Ribbon

macOS has no way to move between windows with H, J, K and L. A window manager adds it. The trick is picking a modifier that no app uses: ⌘ clashes with everything and ⌥ types special characters, so ⌃⌥ together or a Hyper key are the usual choices. Ribbon's defaults are ⌃⌥H/J/K/L.

Choosing a modifier

ModifierProblem
⌘⌘H hides the app, ⌘L is the address bar, ⌘K is used by many apps. Clashes everywhere.
⌥ aloneTypes characters like ˙ ∆ ˚ ¬ on a US layout, and more on others. Fine if you never type those, a pain if you do.
⌃ alone⌃H, ⌃J, ⌃K and ⌃L all mean something in terminals and text fields.
⌃⌥Almost nothing uses it. Two keys, but they sit side by side on Mac keyboards.
Hyper (⌃⌥⇧⌘ on Caps Lock)No clashes, one finger. Needs a remapping tool. See Hyper key on a Mac.

The window managers

All of these let you bind hjkl; they differ in what the keys do.

How hjkl works in Ribbon

Ribbon is a scrolling window manager: windows are columns on a horizontal strip, and a column can hold a stack of windows. So the four keys map naturally:

KeysAction
⌃⌥H / LFocus the column to the left or right; the strip scrolls to follow
⌃⌥J / KFocus down or up within a stacked column
⌃⌥⇧H/J/K/LMove the window in that direction
⌃⌥1–9Jump to a window by position
⌃⌥⌘← / →First or last window on the strip

The arrow keys work as well as hjkl, and every binding can be changed in Settings, including moving everything to a Hyper key. If you're coming from niri, the niri keybindings guide maps each bind. Try hjkl in the live demo; Ribbon is $9.99 once.

Vim keys beyond windows

FAQ

Can I use hjkl to switch windows on a Mac?

Not with built-in tools. A window manager adds it; Ribbon's defaults are ⌃⌥H/J/K/L.

Which modifier should I use for window shortcuts on macOS?

⌃⌥ or a Hyper key. ⌘ clashes with app shortcuts and ⌥ alone types special characters.

Will Control-Option-H clash with anything?

Rarely. A few apps use ⌃⌥ shortcuts, and VoiceOver uses ⌃⌥ as its modifier while it's turned on. You can rebind any Ribbon shortcut.

Keep reading