Enabling key-repeat for VSCode (Visual Studio Code) will vary based on your operating system. Find your operating system below and follow the instructions.

Instructions

macOS

To enable key repeat on mac for VSCode + Vim, run the following commands in the Terminal:

# For VSCode
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

# For VSCode Insiders
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false

# For VSCodium
defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false

# To enable global key-repeat
# this is helpful if you're using Vim in a PWA like code-server
defaults write -g ApplePressAndHoldEnabled -bool false

Windows

You shouldn’t have to adjust anything. If you do need to, take a look at the Settings inside VSCodeVim

Obisidian

If you want to enable key-repeating for a specific application like Obsidian, follow these steps.

macOS

Run the following command in the Terminal:

defaults write md.obsidian ApplePressAndHoldEnabled -bool false

I asked this a while back in the Obsidian Forums and someone finally figured out the answer!

Adjust Key Repeat Settings

It’s also suggested that you increase Key Repeat and Delay Until Repeat settings.

macOS

  1. System Preferences -> Keyboard
  2. Adjsut Key Repeat -> Short
  3. Adjust Delay Until Repeat -> Short

Windows

  1. Select Settings
  2. Type in “Keyboard”
  3. Click on “Typing settings”
  4. Under speed, adjust Repeat delay -> Short
  5. Adjust Repeat rate - > Fast

Remap caps lock to ESC

A pro tip for using Vim with VSCode is to remap caps lock to escape. This makes vim key repeat work a lot smoother.

macOS

  1. System Preferences -> Keyboard
  2. Modifer Keys -> Caps Lock -> ESC

Windows

Look into the uncap project