tabs in vi

Steve Nuchia steve at nuchat.UUCP
Thu Aug 24 05:33:36 AEST 1989


In article <36790001 at hpindwa.HP.COM> sgordon at hpindwa.HP.COM (Shaun Gordon) writes:
>> Is there a way to make it so that when ever I hit the TAB key
>> in 'vi' that I get 4 spaces rather than an actual tab?  I would

>While inside vi you can type a colon to get to the command line and then enter:
>set tabstop=4

I don't recommend that, since everything else in the world -- print
formatters and other people's screens to name two -- will continue
to assume tabstops at 8 columns.  In fact there is no way to make vi
insert anything other than a tab when you hit the tab key.  What I
do recomend is leaving tabstop alone and setting shiftwidth=4.  This
allows you to use ^T as a soft tab and << and >> will shift lines
in four column increments -- just right for programming.  Most people
will find it handy to also set autoindent.  ^D in insert mode will
delete one shiftwidth of leading indentation.

Another handy vi idiom for programmers -- you can shift a whole
block of C by combining the < or > shift operators with the %
(bracket match) command as a target specifier.
-- 
Steve Nuchia	      South Coast Computing Services
uunet!nuchat!steve    POB 890952  Houston, Texas  77289
(713) 964 2462	      Consultation & Systems, Support for PD Software.



More information about the Comp.unix.questions mailing list