Replace Esc with CapsLock for Vim in VSCode on Windows
Learn how to use AutoHotkey to remap CapsLock to Esc, giving you a comfortable escape key in Vim mode within VSCode—and eliminating the CapsLock toggle annoyance.
Note: This article was translated with the assistance of AI. I wrote the original in Chinese.
If you can read Chinese, you are welcome to read the original Chinese version for the most authentic and unfiltered expression.
Implemented with AutoHotkey.
Why not use VSCode’s built-in key mapping?
I tried the solution found online, but every time I pressed Esc to return, it also toggled the Caps Lock state, which felt unnatural.
Since the script is written for version 2.0, choose Download v2.0 when downloading.
Write the script
Create a vscode-vim.ahk script in a suitable location. If you want it to run at startup, you can write it directly under shell:startup, or create a shortcut to the script in the startup directory.