1

In vim :let @"=@* will copy the content of* register to the " register. How can it be done with evil?

2 Answers 2

1

This code should do that.

(set-register ?" (get-register ?*))

If you want that in a command:

(defun foo ()
  (interactive)
  (set-register ?" (get-register ?*)))

Or if you want a command that reads the register names:

(defun copy-register-to-register (from to)
  (interactive
   (list (register-read-with-preview "From register: ")
         (register-read-with-preview "To register: ")))
  (set-register to (get-register from)))

(Emacs registers are not particular to Evil, so Evil is, I think irrelevant to your question. Evil may be how you interact with registers, but setting them with Elisp should independent of Evil.)

0
(evil-set-register ?\" (evil-get-register ?*))
1
  • Could you say something about how these versions are in relation to than the standard emacs functions? Should they be preferred? Apr 5, 2021 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.