Skip to content

Instantly share code, notes, and snippets.

@dfendr
Last active March 8, 2023 14:41
Show Gist options
  • Save dfendr/7e087d478caa3fcd83ba2f34763562b9 to your computer and use it in GitHub Desktop.
Save dfendr/7e087d478caa3fcd83ba2f34763562b9 to your computer and use it in GitHub Desktop.
Vim Keyboard configurations to map Caps as Esc when tapped, ctrl when held. macOS uses custom-capslock.json with Karabiner Elements, and Linux uses keyboard.conf with keyd.
{
"title": "Change caps_lock to Esc and Control",
"rules": [
{
"description": "Post Esc if Caps is tapped, Control if held.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "escape"
}
]
}
]
}
]
}
[ids]
*
[main]
# Maps capslock to escape when pressed and control when held.
capslock = overload(control, esc)
# Remaps the escape key to capslock
esc = capslock
# Swap Left Alt with Left Ctrl for Compat with MacOS habits
leftalt = layer(control)
leftcontrol = layer(alt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment