can vi/ex source beginning of text on startup?

Guy Harris guy at rlgvax.UUCP
Sat Dec 8 15:39:31 AEST 1984


> > I recall seeing a text file with ex commands at the beginning, e.g.
> > 
> > (some characters):set wrapmargin=10
> > 
> > It seemed like ex was meant to source the lines when starting up.
> > Does this work and is it documented?
> 
> Sure, it works, but I don't know where it's documented.

It's not documented anywhere, for which the author apologized a while ago.

> Basically, what you want to do is to automatically initialize your editing
> environment whenever you invoke vi.

The intent of this feature (those lines are called "mode lines") was to
permit the initial ex/vi environment to be dependent on the file you're
editing.  A laudable goal, I guess (I use neither "vi", which has mode lines
in the 3.7 release, nor "emacs", which I believe permits you to do this
kind of initializing based on the file type, i.e. on the last component
of the file name, like ".c", ".s", etc., and my favorite editor has no
modes to be set) but it can trap the unwary.  A long time ago, somebody
posted changes to make this feature disabled by default and requiring you
to set the "modelines" flag to enable it; it sounds like this is the right
way to go and it's what we've done on our systems.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix mailing list