tabs in vi

David Elliott dce at Solbourne.COM
Thu Aug 24 02:55:37 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
>> rather not have to run expand after running vi, as I would only
>> want to do that if I actually changed the file.

I think all solutions to this assume that "I get 4 spaces" really means
"I get to the next column for which column%4 == 0".  To get exactly
4 spaces for a tab is pretty hard in the general case, since it's
hard to map tab and hard to get spaces in the mapping.

What you really need, as Shaun points out, is

>set tabstop=4

In addition, you should set shiftwidth=4 so that > and < will use the
expected units.

-- 
David Elliott		dce at Solbourne.COM
			...!{uunet,boulder,nbires,sun}!stan!dce

"I had a dream that my kids had been reparented." - Tom LaStrange



More information about the Comp.unix.questions mailing list