DEV Community

Lawrence Chen
Lawrence Chen

Posted on • Edited on

1 1

Remap Caps Lock to Escape or Control

Emacs

Caps Lock to Control

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}'
Enter fullscreen mode Exit fullscreen mode

Vim

Caps Lock to Escape

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}'
Enter fullscreen mode Exit fullscreen mode

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}]}'
Enter fullscreen mode Exit fullscreen mode

Learn More (Remap Other Keys)

https://developer.apple.com/library/archive/technotes/tn2450/_index.html

Credits: https://superuser.com/a/1405422

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay