MainspringGuides › Key Repeat for Vim
macOS Guide

Speed up key repeat for coding and Vim

Updated July 2026 · 3 min read

Vim's whole design assumes held keys move fast: hold j to slide down a file, x to chew through characters, h and l to walk a line. On a fresh Mac both feel like wading through syrup — and there are two separate causes, not one. Speed up the repeat rate with KeyRepeat and InitialKeyRepeat, then disable press-and-hold so held keys repeat instead of offering accents.

Two settings make Vim feel slow

People usually blame the repeat rate, but on a stock macOS install the bigger offender for a Vim user is often a different setting entirely:

Fix both and modal editing finally feels the way it does on Linux. Fix only the rate and you'll still hit the wall on the letter keys.

Set the repeat rate

You can drag System Settings → Keyboard → Key Repeat to Fast and Delay Until Repeat to Short, but coders usually want the exact values:

# fast repeat, short initial delay
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15

# undo — back to macOS defaults
defaults delete NSGlobalDomain KeyRepeat
defaults delete NSGlobalDomain InitialKeyRepeat

Lower is faster; both are in units of about 15ms. InitialKeyRepeat matters as much as the rate for editing — it's the pause before j starts scrolling, and a short delay is what makes navigation feel instant. The change needs a logout to take full effect across every app.

Disable press-and-hold so keys repeat

# make held keys repeat instead of showing accents
defaults write -g ApplePressAndHoldEnabled -bool false

# undo — restore the accent picker
defaults delete -g ApplePressAndHoldEnabled

-g is shorthand for NSGlobalDomain, the same domain as above. Quit and reopen your editor (or the terminal running Vim) so it re-reads the setting — no full logout required for this one. You'll lose the hold-for-accents popup, which almost no coder uses anyway; accented characters are still available through the input menu.

Both toggles, no memorising

Mainspring exposes key repeat and press-and-hold as labelled switches you flip once and reset anytime — two of 90+ hidden macOS settings it turns into reversible toggles, so a new Mac is Vim-ready in seconds.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

Free up the Escape key while you're here

Modal editing lives on Escape, and Caps Lock is far easier to reach. See how to remap Caps Lock on Mac to turn that dead key into Escape or Control for a saner Vim setup.