Is it possible to map ‘Ctrl+CapsLock’ to escape key in VSCode Vim?
5,809
I found a solution to map Ctrl+CapsLock
to vim_escape
key.
-
Enter “Preferences: Open Keyboard Shortcut” Menu (using Ctrl +Shift+P)
-
Click a
extension.vim_escape
item. -
Press Enter key.
Related videos on Youtube
Author by
Afrontend
Updated on September 18, 2022Comments
-
Afrontend over 1 year
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 toextension.vim_escape
of “Preferences: Open Keyboard Shortcut”. A key input window is closed when press a CapsLock key. -
Giacomo1968 almost 5 yearsExcellent self-answered question!
-
phuongnd about 4 yearsIt worked like a charm
-
durka42 over 2 yearsI found two notes: 1) You can right click and "Add Keybinding" to keep the original as an option for
vim_escape
. 2) The keybinding I am trying to add is CapsLock+[ (I have caps lock mapped as control via xmodmap but VS Code seems to see through this somehow...) and holding the key combination down for a while does nothing. However, very quickly pressing CapsLock+[+Enter does the trick! -
Giacomo1968 over 2 yearsNothing wrong with linking an answer from another Stack Exchange site, but you should quote pertinent text from the answer here as well so this answer is complete. Otherwise, it’s just a link-only answer.
-
DarkDiamond over 2 yearsWhile this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review