Skip to content

Instantly share code, notes, and snippets.

@cxx
Created February 12, 2024 14:45
Show Gist options
  • Save cxx/4a2e91128871b36ec4d35d85fa644988 to your computer and use it in GitHub Desktop.
Save cxx/4a2e91128871b36ec4d35d85fa644988 to your computer and use it in GitHub Desktop.
# Credit: https://github.com/mooz/xkeysnail/blob/bf3c93b4fe6efd42893db4e6588e5ef1c4909cfb/example/config.py#L62-L125
shared:
terminals: &terminals
- gnome-terminal-server
- qterminal
- Com.github.amezin.ddterm
- emacs
virtual_modifiers:
- CapsLock
modmap:
- application:
only: *terminals
remap:
capslock: ctrl_l
keymap:
- name: Emacs
application:
not: *terminals
remap:
# Cursor
CapsLock-b: { with_mark: left }
CapsLock-f: { with_mark: right }
CapsLock-p: { with_mark: up }
CapsLock-n: { with_mark: down }
# Forward/Backward word
M-b: { with_mark: C-left }
CapsLock-left: { with_mark: C-left }
M-f: { with_mark: C-right }
CapsLock-right: { with_mark: C-right }
# Beginning/End of line
CapsLock-a: { with_mark: home }
CapsLock-e: { with_mark: end }
# Page up/down
M-v: { with_mark: pageup }
CapsLock-v: { with_mark: pagedown }
# Beginning/End of file
M-Shift-comma: { with_mark: C-home }
M-Shift-dot: { with_mark: C-end }
# Newline
CapsLock-m: enter
CapsLock-j: enter
CapsLock-o: [enter, up, end]
# Copy
CapsLock-w: [C-x, { set_mark: false }]
M-w: [C-c, { set_mark: false }]
CapsLock-y: [C-v, { set_mark: false }]
# Delete
CapsLock-d: [delete, { set_mark: false }]
M-d: [C-delete, { set_mark: false }]
CapsLock-h: [backspace, { set_mark: false }]
# Kill line
CapsLock-k: [Shift-end, C-x, { set_mark: false }]
CapsLock-u: [home, Shift-end, C-x, { set_mark: false }]
# Kill word backward
M-backspace: [C-backspace, {set_mark: false}]
# set mark next word continuously.
CapsLock-M-space: [C-Shift-right, {set_mark: true}]
# Undo
CapsLock-slash: [C-z, { set_mark: false }]
CapsLock-Shift-ro: C-z
# Mark
CapsLock-space: { set_mark: true }
# Search
CapsLock-s: C-f
CapsLock-r: Shift-f3
M-Shift-5: C-h
# Cancel
CapsLock-g: [esc, { set_mark: false }]
# Switch tabs
CapsLock-tab: C-tab
CapsLock-Shift-tab: C-Shift-tab
# C-x YYY
CapsLock-x:
remap:
# C-x h (select all)
h: [C-home, C-a, { set_mark: true }]
# C-x C-f (open)
CapsLock-f: C-o
# C-x C-s (save)
CapsLock-s: C-s
# C-x k (kill tab)
k: C-f4
# C-x C-c (exit)
CapsLock-c: C-q
# C-x u (undo)
u: [C-z, { set_mark: false }]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment