How to insert columns in vi


In vi, to insert a column at the beginning of all rows--say you want to indent a section of code:

:%s/^/^ /

To insert a tab at the beginning of the next 15 lines:

:.,+15s/^/<ctrl-v><Enter>/

11/19/2007