Function: viper-repeat-from-history

viper-repeat-from-history is an interactive and byte-compiled function defined in viper-cmd.el.gz.

Signature

(viper-repeat-from-history)

Documentation

Repeat a destructive command from history.

Doesn't change viper-command-ring in any way, so . will work as before executing this command. This command is supposed to be bound to a two-character Vi macro where the second character is a digit 0 to 9. The digit indicates which history command to execute. <char>0 is equivalent to ., <char>1 invokes the command before that, etc.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
(defun viper-repeat-from-history ()
  "Repeat a destructive command from history.
Doesn't change viper-command-ring in any way, so `.' will work as before
executing this command.
This command is supposed to be bound to a two-character Vi macro where
the second character is a digit 0 to 9.  The digit indicates which
history command to execute.  `<char>0' is equivalent to `.', `<char>1'
invokes the command before that, etc."
  (interactive)
  (let* ((viper-intermediate-command 'repeating-display-destructive-command)
	 (idx (cond (viper-this-kbd-macro
		      (string-to-number
		       (symbol-name (elt viper-this-kbd-macro 1))))
		    (t 0)))
	 (num idx)
	 (viper-d-com viper-d-com))

    (or (and (numberp num) (<= 0 num) (<= num 9))
	(progn
	  (setq idx 0
		num 0)
	  (message
	   "`viper-repeat-from-history' must be invoked as a Vi macro bound to `<key><digit>'")))
    (while (< 0 num)
      (setq viper-d-com (viper-special-ring-rotate1 viper-command-ring -1))
      (setq num (1- num)))
    (viper-repeat nil)
    (while (> idx num)
      (viper-special-ring-rotate1 viper-command-ring 1)
      (setq num (1+ num)))
    ))