MainspringGuides › Vim Key Repeat
macOS Guide

Make held keys repeat in VS Code and Vim on Mac

Updated August 2026 · 4 min read

In Vim, holding j should scroll down and holding l should glide the cursor right. On a Mac, holding those keys can instead trigger the accent picker, so navigation stops dead. The culprit is macOS's press-and-hold feature. You can switch it off just for VS Code — the officially recommended fix — or system-wide, and get real held-key repeat back.

The VS Code-only fix (recommended)

You don't have to change this for your whole Mac. macOS lets you set the press-and-hold preference per app, keyed by the app's bundle identifier, so you can leave accents working everywhere else. In Terminal (Applications → Utilities), run:

# Disable press-and-hold for VS Code only
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

# VS Code Insiders uses a different identifier
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false

# Undo — restore the accent menu in VS Code
defaults delete com.microsoft.VSCode ApplePressAndHoldEnabled

Fully quit and reopen VS Code (Cmd+Q, then relaunch) so it reads the new value. Now holding h j k l in Vim mode repeats and moves the cursor, while every other app still offers the accent popup when you hold a vowel. This is the fix the VS Code team themselves point to, and it works on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.

Prefer it system-wide?

If you also use terminal Vim, Neovim, JetBrains IDEs with a Vim plugin, or a standalone editor, a global switch saves you repeating the per-app command for each one:

# Disable press-and-hold for every app
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

# Undo — bring the accent menu back everywhere
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true

The global change takes full effect after you log out and back in (or restart), since apps read the preference at launch. The trade-off is that you'll lose the hold-for-accents shortcut across the whole system — fine for most developers, worth knowing if you also write in other languages.

Terminal Vim is a separate setting

One subtlety trips people up: if you run Vim inside Terminal or iTerm2 rather than through a GUI editor, the press-and-hold behavior belongs to that terminal app, not to Vim. For a terminal emulator, target its own bundle identifier — for example:

# Apple Terminal
defaults write com.apple.Terminal ApplePressAndHoldEnabled -bool false

# iTerm2
defaults write com.googlecode.iterm2 ApplePressAndHoldEnabled -bool false

Quit and reopen the terminal afterward. If you're unsure of an app's identifier, run osascript -e 'id of app "AppName"' to look it up before writing the preference.

Skip the bundle-ID hunting

Mainspring exposes "Disable press-and-hold accent menu" as a labelled system-wide toggle you can flip on for coding and off again in a click — no bundle identifiers, no logout guesswork. It's one of 90+ hidden macOS settings the app makes reversible.

Try Mainspring free →

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

Then make the repeat itself faster

Turning off press-and-hold restores repeat; the repeat rate is a second dial. For snappy hjkl navigation, see how to get faster key repeat for Vim and coding on Mac.