Vim keys for window management on a Mac
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
| Modifier | Problem |
|---|---|
| ⌘ | ⌘H hides the app, ⌘L is the address bar, ⌘K is used by many apps. Clashes everywhere. |
| ⌥ alone | Types 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.
- AeroSpace (free) uses ⌥H/J/K/L by default to focus in its i3-style tree.
- yabai (free) has no keys of its own; you bind hjkl in a hotkey daemon such as skhd and call yabai commands.
- Amethyst (free) cycles focus through windows in its layout with its own default shortcuts, which you can change.
- Ribbon uses ⌃⌥H/J/K/L out of the box.
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:
| Keys | Action |
|---|---|
| ⌃⌥H / L | Focus the column to the left or right; the strip scrolls to follow |
| ⌃⌥J / K | Focus down or up within a stacked column |
| ⌃⌥⇧H/J/K/L | Move the window in that direction |
| ⌃⌥1–9 | Jump 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
- Browser: Vimium for Chromium browsers and Vimium-FF for Firefox give you J/K scrolling, F link hints and H/L history.
- Text fields everywhere: macOS supports Emacs-style keys (⌃A, ⌃E, ⌃N, ⌃P) in nearly every app, which pair well with a Vim habit.
- Editors: VS Code has the Vim extension; JetBrains IDEs have IdeaVim; Zed has a built-in Vim mode.
- Terminal multiplexers: tmux panes are commonly bound to prefix plus hjkl. See tmux or a window manager for how they fit together.
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.