[net.unix] Vi bug: multi-line abbrev w/ ai set

yoda@ittatc.ATC.ITT.UUCP (Todd C. Williams [Jedi Knight]) (03/12/86)

I want to have an abbreviation that will print out the following 5 lines:

	main(argc,argv)
		int argc;
		char *argv[];
	{
	}

I want to put this is my .exrc file.  I have already set autoindent in this
file.  The problem is that, with autoindent set, multiline abbreviations
are tabbed in by autoindent, with (apparently) no way to stop this.  I tried
the obvious ^D's, but to no avail, even when lnext quoted.  Can anyone help?


EXAMPLES that do NOT work:

THIS (in .exrc):

set	autoindent
abbreviate	aaaaa	main(argc,argv)^M^Iint argc;^Mchar *argv[];^M^D{^M}

PRODUCES:
main(argc,argv)
	int argc;
	char *argv[];
	{
	}


adding additional ^D's, quoted or not, does not work.

We are running 4.1bsd on a VAX-11/780.
						-Todd Williams

-- 
+------------------------------------------------------------------------------+
|  Todd C. Williams			|  "Summer blonds		       |
|  ITT Defense Communications		|   revealing tan lines,	       |
|  Nutley, NJ				|   I'll make more moves than	       |
|  {decvax, et al.}!ittatc!dcdvaxb!tcw	|   ALLIED VAN LINES!"		       |
|  I love to receive e-mail from anyone!|     --from: "I wanna be a lifeguard" |
|					|			by BLOTTO      |
+------------------------------------------------------------------------------+

larry@geowhiz.UUCP (Larry McVoy) (03/14/86)

In article <1727@ittatc.ATC.ITT.UUCP> yoda@ittatc.ATC.ITT.UUCP (Todd C. Williams [Jedi Knight]) writes:
>EXAMPLES that do NOT work:
>
>THIS (in .exrc):
>
>set	autoindent
>abbreviate	aaaaa	main(argc,argv)^M^Iint argc;^Mchar *argv[];^M^D{^M}

Umm... this is too simple to work, but how about:

abbreviate	foo	:set noai
Imain(argc,argv)^M^Iint argc;^Mchar *argv[];^M^D{^M}:set ai

Which, escapes out of insert, sets no ai, does it, escapes, sets ai back.
I know, a kludge.
-- 
Larry McVoy
-----------
Arpa:  mcvoy@rsch.wisc.edu                              
Uucp:  {seismo, ihnp4}!uwvax!geowhiz!geophiz!larry      

"Just remember, wherever you go -- there you are."
 	-Buckaroo Banzai

ajs@hpfcla (03/17/86)

> I want to have an abbreviation that will print out the following 5 lines:
> 
>	main(argc,argv)
>		int argc;
>		char *argv[];
>	{
>	}

Off on a tangent:

I have the sneaky suspicion that you are trying to save time writing
programs (an admirable goal).  But, unless you write a lot of quick
little throwaways, you're either going to write some pretty abominable
code, or you don't really want to stick in your .exrc all the stuff a
good "starting point" should include.

Instead, why don't you craft a reasonable "template.c" to suit your
tastes, and just hide in vi the finger macro to read it in?  For
instance, my own "template.c", iteratively refined over time and
including a number of commonly-used utility routines, is 176 lines long.

"Pride in craftsmanship is a winning strategy."

Alan Silverstein, Hewlett-Packard Fort Collins Systems Division, Colorado
{ihnp4 | hplabs}!hpfcla!ajs, 303-226-3800 x3053, N 40 31'31" W 105 00'43"