From 1de08f0988f7c1dcf1307391c6f88f6c97b63fac Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 24 Jul 2025 10:11:45 +0200 Subject: emacs: Fix execution of my default macro key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently C-2 was being interpreted as C-@. So, let's move the lambda I was using into a function, so it can be assigned to both bindings. Signed-off-by: Miquel Sabaté Solà --- .config/emacs/init.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to '.config') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 4018538..4c2b383 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -107,6 +107,11 @@ :states '(insert normal) "C-z" #'evil-escape)) +(defun run-q-macro (n) + "Run the macro stored on the 'q' key `N' times." + (interactive "p") + (evil-execute-macro n "@q")) + ;; Sane key-binding management. (use-package general :after evil @@ -117,9 +122,8 @@ :states 'normal "C-s" #'save-buffer "C-e" #'evil-end-of-line - "C-2" (lambda (n) - (interactive "p") - (evil-execute-macro n "@q"))) + "C-2" #'run-q-macro + "C-@" #'run-q-macro) ;; And being cheeky with a C-s for saving even in insert mode. (general-define-key -- cgit v1.2.3