branch: master commit 6c6fc0be00822622eeb9a3df9b9d432522a6ca4e Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Allow `hydra-repeat' to take a numeric arg * hydra.el (hydra-repeat): Update. It's possible now, for instance with `hydra-vi' to do this: 4j.2.. This will forward-line 4 times (4j), 4 times (.), 2 times (2.), 2 times (.). Fixes #92 --- hydra.el | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hydra.el b/hydra.el index 049650a..3e4d311 100644 --- a/hydra.el +++ b/hydra.el @@ -230,12 +230,15 @@ Vanquishable only through a blue head.") (defvar hydra-repeat--command nil "Command to use with `hydra-repeat'.") -(defun hydra-repeat () - "Repeat last command with last prefix arg." - (interactive) - (unless (string-match "hydra-repeat$" (symbol-name last-command)) - (setq hydra-repeat--command last-command) - (setq hydra-repeat--prefix-arg last-prefix-arg)) +(defun hydra-repeat (&optional arg) + "Repeat last command with last prefix arg. +When ARG is non-nil, use that instead." + (interactive "p") + (if (eq arg 1) + (unless (string-match "hydra-repeat$" (symbol-name last-command)) + (setq hydra-repeat--command last-command) + (setq hydra-repeat--prefix-arg last-prefix-arg)) + (setq hydra-repeat--prefix-arg arg)) (setq current-prefix-arg hydra-repeat--prefix-arg) (funcall hydra-repeat--command))