Function: evil-copy

evil-copy is an interactive and byte-compiled function defined in evil-commands.el.

Signature

(evil-copy BEG END ADDRESS)

Documentation

Copy lines in BEG END below line given by ADDRESS.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-command evil-copy (beg end address)
  "Copy lines in BEG END below line given by ADDRESS."
  :motion evil-line-or-visual-line
  (interactive "<r><addr>")
  (goto-char (point-min))
  (forward-line address)
  (let* ((txt (buffer-substring-no-properties beg end))
         (len (length txt)))
    ;; ensure text consists of complete lines
    (when (or (zerop len) (/= (aref txt (1- len)) ?\n))
      (setq txt (concat txt "\n")))
    (when (and (eobp) (not (bolp))) (newline)) ; incomplete last line
    (insert txt)
    (forward-line -1)))