Rewrite whitespace runs containing tabs
:retab
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2 one
twoCursor on line 1, column 1 one
twoCursor on line 1, column 1 one
twoCursor on line 1, column 2Rewrite whitespace runs containing tabs.
Command entered · ready to apply
Converted each leading tab to two spaces.
Before & after
one
twoCursor on line 1, column 1 one
twoCursor on line 1, column 2Start in Normal mode. The buttons include the concrete range and arguments used for this example; press Enter to execute. Indentation uses expandtab and shiftwidth=2. tabstop=2, so each leading tab becomes two spaces with expandtab.
Details & Vim help
Example replayed in Vim
Run :retab to rewrite whitespace runs that contain a tab, using the current tab and expandtab settings. A supplied tab size also sets 'tabstop'. With !, runs of spaces can be rewritten as well.