Replacing tabs in vi

William A. Stubblebine was at hplsdlw.HP.COM
Mon Jan 19 15:27:29 AEST 1987


randy at tekla.UUCP (Randy Gibbons) asks:

> Is there a way in vi to have spaces rather than tabs placed in the
text.

Unfortunately, vi has an annoying tendency to auto-indent using tabs.  I
don't know of a way to disable this (mis) feature.  However, once the
tabe are in the file, you can remove them (i.e., replace with the
equivalent number of spaces) easily using the following vi commands:

	1G		(top of file)
	!Gcol -x	(replace contents of file with detabbed output
			of col -x)
		
Of course, in the above example, any motion symbol (H,L,}, etc.)  can be
substituted for G to localize the substitution


                                Bill Stubblebine
                                Hewlett-Packard Logic Systems Div.
                                1900 Garden of the Gods Rd.
                                Colorado Springs, Co. 80907
                                ...!ihnp4!hpfcla!hpldola!was
                                (303) 590-3072



More information about the Comp.unix.questions mailing list