diff options
author | shoshin <shoshin@cicadas.surf> | 2022-07-17 11:47:17 -0500 |
---|---|---|
committer | shoshin <shoshin@cicadas.surf> | 2022-07-17 11:47:17 -0500 |
commit | 0c422cf727ccec76c77bfeff1c73171e6bb1b0b9 (patch) | |
tree | 7b22d954ad2fccd5d3cd12318581078423e12937 /shoshin-config.el | |
parent | f7841f24ae6ea0d36b5ad397268fd90fafdec1bd (diff) |
Add: personal with-map-defkey macro for leader keymaps
Diffstat (limited to 'shoshin-config.el')
-rw-r--r-- | shoshin-config.el | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/shoshin-config.el b/shoshin-config.el index 3718296..c104247 100644 --- a/shoshin-config.el +++ b/shoshin-config.el @@ -29,6 +29,49 @@ (define-key 'xah-fly-leader-key-map (kbd "1") #'delete-other-windows) +(defmacro with-map-defkey (keymap leader &rest pairs) + "Define a new KEYMAP with prefix key LEADER, and list of bindings in it." + (declare (indent 2)) + `(progn + (defvar ,keymap (make-sparse-keymap)) + (define-prefix-command (quote ,keymap)) + (global-set-key (kbd ,leader) ,keymap) + (mapc (lambda (pair) + (define-key ,keymap + (kbd (if (numberp (car pair)) (number-to-string (car pair)) + (symbol-name (car pair)))) + (cadr pair))) + (quote ,(seq-partition pairs 2))))) + +(defvar *my-config* "~/projects/shoshimacs/shoshin-config.org" + "Path to my main configuration file.") + +(defun my-configuration () + (interactive) + (find-file *my-config*)) + +(defun my-reload-config () + "Tangles and reloads a literate config with `org-babel-load-file'" + (interactive) + (org-babel-load-file *my-config*)) + +(with-map-defkey my-key-map "M-m" + 1 delete-other-windows + a apropos + b consult-buffer + c my-config + d embark-act + e eshell + f find-file + g magit + h info + i consult-imenu + j describe-function + k describe-variable + t consult-theme + w which-key-mode + <f1> my-reload-config) + ;;; Completion (setq completion-styles '(flex basic partial-completion emacs22) completion-cycle-threshold 3 |