Skip to content
Batuhan Basmaz Ölmez edited this page Apr 21, 2023 · 2 revisions

Prefix keys with user mode local key sequence

  (defvar local-leader-prefix "C-c")

  (defun keys-make-local-prefix (&optional key)
    (concat local-leader-prefix (if key " ") key))

  (defun bind-local (&optional key &rest bindings)
    (declare (indent 1))
    (if (eq (type-of key) (type-of (car bindings)))
        (progn
          (apply #'bind-prefix (keys-make-local-prefix key) bindings))
      (apply #'bind-prefix (keys-make-local-prefix) (cons key bindings))))
Clone this wiki locally