[comp.unix.questions] Vi and tabs

spl@mcnc.org (Steve Lamont) (06/19/89)

What is the magic set of incantations to stop vi from inserting
gratutious (at least from my perspective) tabs in text while doing
autoindent?  F'rinstance if I type something like

	function( parameter1,
		  parameter2,
		  parameter3 );

vi very 'helpfully' will stick a tab and some spaces before the string
'parameter3.'  I would prefer spaces (humor me :-) ).

As they say on the radio talk shows, "I'll take my answer on the air."
That is, email will do just fine.


-- 
							spl
Steve Lamont, sciViGuy			EMail:	spl@ncsc.org
North Carolina Supercomputing Center	Phone: (919) 248-1120
Box 12732/RTP, NC 27709

envbvs@epb2.lbl.gov (Brian V. Smith) (06/21/89)

In article <4732@alvin.mcnc.org>, spl@mcnc.org (Steve Lamont) writes:

> What is the magic set of incantations to stop vi from inserting
> gratutious (at least from my perspective) tabs in text while doing
> autoindent?  F'rinstance if I type something like
> 
> 	function( parameter1,
> 		  parameter2,
> 		  parameter3 );
> 
> vi very 'helpfully' will stick a tab and some spaces before the string
> 'parameter3.'  I would prefer spaces (humor me :-) ).
> 
> As they say on the radio talk shows, "I'll take my answer on the air."
> That is, email will do just fine.

I just happened to be looking in the newsgroup 'comp.lang.fortran' 
(don't ask why) and I came across the following article:

< Article 1784 of comp.lang.fortran

< From: bobal@microsoft.UUCP (Bob Allison)
< Reply-To: bobal@microsoft.UUCP (Bob Allison (uunet!microsoft!bobal))
< Distribution: usa
< Organization: Microsoft Corp., Redmond WA
< Lines: 39
< 
< Not that this has anything to do with FORTRAN, but for those of us
< who love autoindent, but don't like tabs, the appropriate vi setting is:
< 
< :set ai ts=90
< 
< This is great since it will autoindent, but it won't use a tab unless you're
< beyond the 90th column (I rarely write a line longer than 80 characters), so
< it just blank-fills.
< 

[stuff about Fortran 88 deleted ]

< Bob Allison
< uunet!microsoft!bobal


_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
We don't need no signatures!

ghe@nucthy.physics.orst.edu (Guangliang He) (06/21/89)

In article <2852@helios.ee.lbl.gov> envbvs@epb2.lbl.gov (Brian V. Smith) writes:
=In article <4732@alvin.mcnc.org>, spl@mcnc.org (Steve Lamont) writes:
=
=> What is the magic set of incantations to stop vi from inserting
=> gratutious (at least from my perspective) tabs in text while doing
=> autoindent?  F'rinstance if I type something like
=> 
=> 	function( parameter1,
=> 		  parameter2,
=> 		  parameter3 );
=> 
=> vi very 'helpfully' will stick a tab and some spaces before the string
=> 'parameter3.'  I would prefer spaces (humor me :-) ).
=> 
=> As they say on the radio talk shows, "I'll take my answer on the air."
=> That is, email will do just fine.
=
=I just happened to be looking in the newsgroup 'comp.lang.fortran' 
=(don't ask why) and I came across the following article:
=
=< Article 1784 of comp.lang.fortran
=
=< From: bobal@microsoft.UUCP (Bob Allison)
=< Reply-To: bobal@microsoft.UUCP (Bob Allison (uunet!microsoft!bobal))
=< Distribution: usa
=< Organization: Microsoft Corp., Redmond WA
=< Lines: 39
=< 
=< Not that this has anything to do with FORTRAN, but for those of us
=< who love autoindent, but don't like tabs, the appropriate vi setting is:
=< 
=< :set ai ts=90
=< 
=< This is great since it will autoindent, but it won't use a tab unless you're
=< beyond the 90th column (I rarely write a line longer than 80 characters), so
=< it just blank-fills.
=< 
=
=[stuff about Fortran 88 deleted ]
=

Although ":set ai ts=90" does what Bob said in the article, it has its
problem when you put it into .exrc file. If this line exists in .exrc file, 
it will simply expand every tab to 90 spaces. It is really painful when you
are editting a old file with tabs in it. Does any one have a better way to 
solve the tab problem ???

-----------------------------------------------------------------------
                                   |
USMAIL:   Guangliang He            |  INTERNET: ghe@PHYSICS.ORST.EDU
          Department of Physics    |            ghe@jacobs.CS.ORST.EDU
          Oregon State University  |  BITNET:   hegl@orstvm.bitnet
          Corvallis, OR 97331      |  PHONE:    (503) 737-4631
                                   |
-----------------------------------------------------------------------

steve@umigw.MIAMI.EDU (steve emmerson) (06/21/89)

In article <11316@orstcs.CS.ORST.EDU> ghe@nucthy.PHYSICS.ORST.EDU 
(Guangliang He) writes [refering to ":se ai ts=90" in .exrc]:
>
>It is really painful when you
>are editting a old file with tabs in it. Does any one have a better way to 
>solve the tab problem ???

Use tabs, then run the file through expand(1).  Map it to a vi macro if you
want.
-- 
Steve Emmerson                     Inet: steve@umigw.miami.edu [128.116.10.1]
SPAN: miami::emmerson (host 3074::)      emmerson%miami.span@star.stanford.edu
UUCP: ...!ncar!umigw!steve               emmerson%miami.span@vlsi.jpl.nasa.gov
"Computers are like God in the Old Testament: lots of rules and no mercy"

jws@hpcljws.HP.COM (John Stafford) (06/22/89)

But beware of setting a "large" tab stop and then editing a file which
already contains tabs.  You might be able to guess the result...