Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2020 03:25
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dangirsh/86c001351c02b42321d20f462a66da6b to your computer and use it in GitHub Desktop.
Combine key-chord.el with key maps to have many quick bindings in non-modal settings
(defun add-to-keymap (keymap bindings)
(dolist (binding bindings)
(define-key keymap (kbd (car binding)) (cdr binding))))
(defun add-to-dk-keymap (bindings)
(add-to-keymap dk-keymap bindings))
;; Example usage with dk and sl
(setq dk-keymap (make-sparse-keymap))
(setq sl-keymap (make-sparse-keymap))
(key-chord-define-global "dk" dk-keymap)
(key-chord-define-global "sl" sl-keymap)
(defun add-to-sl-keymap (bindings)
(add-to-keymap sl-keymap bindings))
'(("<SPC>" . rgrep)
("o" . ibuffer)
("s" . save-buffer)
("." . pop-global-mark)))
'(("k" . magit-dispatch-popup)
("s" . magit-status)
("o" . magit-log)
("u" . magit-submodule-update)
("l" . magit-show-refs-head)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment