Function: evil-retab
evil-retab is an interactive and byte-compiled function defined in
evil-commands.el.
Signature
(evil-retab TABSTOP)
Documentation
Convert all tabs to spaces or the other way around.
Replace all sequences of white-space containing a <Tab> with new
strings of white-space using the new TABSTOP value given.
If you do not specify a new TABSTOP size or it is zero, Evil uses the
current value of tab-width.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-command evil-retab (tabstop)
"Convert all tabs to spaces or the other way around.
Replace all sequences of white-space containing a <Tab> with new
strings of white-space using the new TABSTOP value given.
If you do not specify a new TABSTOP size or it is zero, Evil uses the
current value of `tab-width'."
(interactive "<a>")
(unless (or (not tabstop) (string-match-p "^[0-9]*$" tabstop))
(user-error "Invalid argument: %s" tabstop))
(let ((beg (if (use-region-p) (region-beginning) (point-min)))
(end (if (use-region-p) (region-end) (point-max)))
(retab (if indent-tabs-mode #'tabify #'untabify))
(tab-width (cond ((not tabstop) tab-width)
((equal tabstop "0") tab-width)
(t (string-to-number tabstop)))))
(funcall retab beg end)))