From 7075bdf706d83116e85879de8b680b753549eac0 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 19 Oct 2016 14:08:01 +0200 Subject: emacs: fixed the macro handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 9328174..25ecc80 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -351,11 +351,15 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit) (define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit) - ; I store macros on the register for convenience, so let's also use the - ; combo to execute the macro. - ; TODO: not really working - (define-key evil-normal-state-map (kbd "C-q") - (lambda () (interactive) (evil-execute-macro 1 'q))) + ; I store macros on the register for convenience, so I used to use the + ; combo to execute this macro in Vim. In Emacs though, this combo is + ; reserved to a rather useful function, and I'd like to keep it that way. So, + ; now the mapping is set to (mnemonic: where the @ symbol is). Moreover, + ; it's applied as many times as specified by the numeric prefix argument. + (define-key evil-normal-state-map (kbd "C-2") + (lambda (n) + (interactive "p") + (evil-execute-macro n "@q"))) ; C-s: switch to normal mode and save the buffer. I know :) (define-key evil-normal-state-map (kbd "C-s") 'save-buffer) -- cgit v1.2.3