Function: avy-kill-whole-line

avy-kill-whole-line is an autoloaded, interactive and byte-compiled function defined in avy.el.

Signature

(avy-kill-whole-line ARG)

Documentation

Select line and kill the whole selected line.

With a numerical prefix ARG, kill ARG line(s) starting from the selected line. If ARG is negative, kill backward.

If ARG is zero, kill the selected line but exclude the trailing newline.

C-u (universal-argument) 3 M-x avy-kil-whole-line (avy-kil-whole-line) kill three lines starting from the selected line. C-u (universal-argument) -3

M-x avy-kill-whole-line (avy-kill-whole-line) kill three lines backward including the selected line.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-kill-whole-line (arg)
  "Select line and kill the whole selected line.

With a numerical prefix ARG, kill ARG line(s) starting from the
selected line.  If ARG is negative, kill backward.

If ARG is zero, kill the selected line but exclude the trailing
newline.

\\[universal-argument] 3 \\[avy-kil-whole-line] kill three lines
starting from the selected line.  \\[universal-argument] -3

\\[avy-kill-whole-line] kill three lines backward including the
selected line."
  (interactive "P")
  (let ((initial-window (selected-window)))
    (avy-with avy-kill-whole-line
      (let* ((start (avy--line)))
        (if (not (numberp start))
            (user-error "Fail to select the line to kill")
          (save-excursion (goto-char start)
                          (kill-whole-line arg)))))
    (select-window initial-window)))