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


This code should do that.

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

If you want that in a command:

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

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

(defun copy-register-to-register (from to)
   (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.)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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