Function: evil-indent

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

Signature

(evil-indent BEG END)

Documentation

Indent text.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-operator evil-indent (beg end)
  "Indent text."
  :move-point nil
  :type line
  (evil-ensure-column
    (setq this-command real-this-command) ; Reset change made by evil-ensure-column
    (save-restriction
      (narrow-to-region beg end)
      (if (save-excursion (goto-char beg) (= end (line-beginning-position 2)))
          ;; since some Emacs modes can only indent one line at a time,
          ;; implement "==" as a call to `indent-according-to-mode'
          (indent-according-to-mode)
        (goto-char beg)
        (indent-region beg end))
      ;; Tabify or untabify leading whitespace characters
      (when evil-indent-convert-tabs
        ;; Whether tab or space should be used is determined by indent-tabs-mode
        (let ((convert-fun (if indent-tabs-mode #'tabify #'untabify)))
          (save-excursion
            (goto-char (point-min))
            (while (not (eolp))
              (funcall convert-fun (point) (progn (skip-chars-forward " \t") (point)))
              (forward-line))))))))