Skip to content

Instantly share code, notes, and snippets.

@dschaehi
Created March 29, 2020 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschaehi/2d8016130454ae5e2505622e629af4de to your computer and use it in GitHub Desktop.
Save dschaehi/2d8016130454ae5e2505622e629af4de to your computer and use it in GitHub Desktop.
Karabiner Elements complex modifications for emacs
{
"title": "Emacs keys",
"rules": [
{
"description": "Change right_option + a to right_control + a",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "a",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + j to right_control + j",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "c",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "c",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + e to right_control + e",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "d",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + k to right_control + k",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "v",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "v",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + o to right_control + o",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "s",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + p to right_control + p",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "r",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "r",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + u to right_control + u",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "f",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "f",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + x to right_control + x",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "b",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "b",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + y to right_control + y",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "t",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "t",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + x to right_control + x",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "x",
"modifiers": {
"mandatory": "right_option"
}
},
"to": [
{
"key_code": "x",
"modifiers": "right_control"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + right_command + a to right_control + right_option + a",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"right_option",
"right_command"
]
}
},
"to": [
{
"key_code": "a",
"modifiers": [
"right_control",
"right_option"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + right_command + e to right_control + right_option + e",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": [
"right_option",
"right_command"
]
}
},
"to": [
{
"key_code": "d",
"modifiers": [
"right_control",
"right_option"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_option + right_command + p to right_control + right_option + p",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "r",
"modifiers": {
"mandatory": [
"right_option",
"right_command"
]
}
},
"to": [
{
"key_code": "r",
"modifiers": [
"right_control",
"right_option"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + a to right_option + a",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "a",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + e to right_option + e",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "d",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + o to right_option + o",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "s",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + p to right_option + p",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "r",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "r",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + ; to right_option + ;",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "z",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "z",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + . to right_option + .",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "e",
"modifiers": {
"mandatory": "right_command"
}
},
"to": [
{
"key_code": "e",
"modifiers": "right_option"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + right_shift + < to right_option + right_shift + <",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "w",
"modifiers": {
"mandatory": [
"right_command",
"right_shift"
]
}
},
"to": [
{
"key_code": "w",
"modifiers": [
"right_option",
"right_shift"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
},
{
"description": "Change right_command + right_shift + > to right_option + right_shift + >",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "e",
"modifiers": {
"mandatory": [
"right_command",
"right_shift"
]
}
},
"to": [
{
"key_code": "e",
"modifiers": [
"right_option",
"right_shift"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$",
"^com\\.googlecode\\.iterm2$",
"^com\\.apple\\.Terminal$"
]
},
{
"type": "device_if",
"identifiers": [
{
"vendor_id": 1452,
"product_id": 657,
"description": "Apple Internal Keyboard / Trackpad"
}
]
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment