Function: evil-justify-lines
evil-justify-lines is a byte-compiled function defined in
evil-common.el.
Signature
(evil-justify-lines BEG END JUSTIFY POSITION)
Documentation
Justify all lines in a range.
BEG and END specify the range of those lines to be
justified. JUSTIFY is either left, right or center according
to the justification type. POSITION is the maximal text width for
right and center justification or the column at which the lines
should be left-aligned for left justification.
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
;;; Alignment
(defun evil-justify-lines (beg end justify position)
"Justify all lines in a range.
BEG and END specify the range of those lines to be
justified. JUSTIFY is either `left', `right' or `center' according
to the justification type. POSITION is the maximal text width for
right and center justification or the column at which the lines
should be left-aligned for left justification."
(let ((fill-column position)
adaptive-fill-mode fill-prefix)
(evil-with-restriction
(save-excursion (goto-char beg) (line-beginning-position))
(save-excursion (goto-char end) (line-end-position (if (bolp) 0 1)))
(goto-char (point-min))
(while (progn
(if (eq justify 'left)
(indent-line-to position)
(when (re-search-forward "^[[:space:]]*" nil t)
(delete-region (match-beginning 0)
(match-end 0)))
(justify-current-line justify nil t))
(and (zerop (forward-line)) (bolp))))
(goto-char (point-min))
(back-to-indentation))))