Vim Recall繁體中文

Rewrite whitespace runs containing tabs

:retab

Example

Normal 0 / 2
	one
	two
Cursor on line 1, column 1

Rewrite whitespace runs containing tabs.

Before & after
Before
	one
	two
Cursor on line 1, column 1
After
  one
  two
Cursor on line 1, column 2

Start 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.