I’m using a CapsLock key as a Ctrl key and an Esc key using below command

remapCapsLockToControl() {
    xmodmap -e 'keycode 66 = Control_L'
    xmodmap -e 'clear Lock'
    xmodmap -e 'add Control = Control_L'
    echo "remapCapsLockToControl"

remapControlToEsc() {
    xcape -e "Control_L=Escape"
    echo "remapControlToEsc"

I can use a CapsLock key as an Esc key in Vim (Ubuntu 18) with these settings. But I can’t use a CapsLock key as an Escape key in VSCode vim mode. VSCode displays a message below when pressing a CapsLock key.

(Ctrl+CapsLock) was pressed. Waiting for second key …

I can’t input the Ctrl+CapsLock key to extension.vim_escape of “Preferences: Open Keyboard Shortcut”. A key input window is closed when press a CapsLock key.


I found a solution to map Ctrl+CapsLock to vim_escape key.

  1. Enter “Preferences: Open Keyboard Shortcut” Menu (using Ctrl +Shift+P)

  2. Click a extension.vim_escpae item.

  3. Press a CapsLock key (Ctrl+CapsLock), don't release a CapsLock key while 3 seconds. and release a CapsLock key.

dialog box for extension.vim_escape key

  1. Press Enter key.

display current extension.vim_escape shortkey

  • Excellent self-answered question! – JakeGould Jun 17 '19 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.