Last Updated: February 25, 2016
· darrell

Indenting text in a file with vi/vim

If you want to indent all the text by one tab stop using vi or vim load the text file into vi and type


where {tab} is CTRL-V CTRL-I. This command says from line 1 to last line ($) subsitute (s) the beginning of line (^) with a TAB character.

You can also do things like move to the first line of a block and indent 5 lines using:


The . means current line and .+4 means current line plus 4 more (1 + 4 = 5).

1 Response
Add your response

Better idea is to select text to indent and use >>, = or :retab

over 1 year ago ·