spacegoing
spacegoing

Reputation: 5306

vscode: Is it possible to make (not remap) `caps lock` as one of the modifier keys?

I am not asking to remap Caps Lock to other modifier keys but I want to configure Caps Lock as one of modifier key for my own usage. Any ideas? :D

Upvotes: 0

Views: 960

Answers (2)

Pedro Ciambra
Pedro Ciambra

Reputation: 29

For x11 OSes like most Linux distros, use xmodmap. Something like

keycode 66 = Alt_L Meta_L
clear mod1
add mod1 = Alt_L Meta_L

in your .Xmodmap file should suffice.

Then run:

xmodmap .Xmodmap

Upvotes: 0

JJPandari
JJPandari

Reputation: 3522

On Windows you can use AutoHotKey(usually briefly as ahk) with the WinActive function to make the ahk script only work when you're in vscode, mapping CapsLock+* keys to usually-not-used combinations like ctrl+shift+alt+* and write the ctrl+shift+alt+* keys to vscode's key configs.

It would roughly look like this:

; comment: the class used here is made up
; right click a running script in the system tray and go to "window spy" to get the right class name
; there are also usual `if`s but this one applies the condition to all the code following it
#If WinActive("ahk_class VSCode")

CapsLock & a::
SendInput, ^+!a
return

And of course if you want to get the function of capslock in the editor, you can easily use a combination like CapsLock & Shift to acomplish it like above.

Upvotes: 3

Related Questions