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
- System Preferences -> Keyboard
- Adjsut Key Repeat -> Short
- Adjust Delay Until Repeat -> Short
Windows
- Select Settings
- Type in “Keyboard”
- Click on “Typing settings”
- Under speed, adjust Repeat delay -> Short
- 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
- System Preferences -> Keyboard
- Modifer Keys -> Caps Lock -> ESC
Windows
Look into the uncap project