Emacs
Caps Lock
to Control
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}'
Vim
Caps Lock
to Escape
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}'
This seems to not affect external keyboards in my setup. If you know a fix, please drop a comment!
Reset
Caps Lock
to Caps Lock
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000039}]}'
Learn More (Remap Other Keys)
https://developer.apple.com/library/archive/technotes/tn2450/_index.html
Credits: https://superuser.com/a/1405422
Top comments (0)