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.
Install AutoHotkey
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.
1 |
|
This script only takes effect in VSCode, swapping the Caps Lock and Esc keys. To enable the script, just double-click to run it.