mode lines in vi - (nf)

rpw3 at fortune.UUCP rpw3 at fortune.UUCP
Tue Apr 24 14:03:05 AEST 1984


#R:cbosgd:-128100:fortune:2000009:000:1233
fortune!rpw3    Apr 23 19:01:00 1984

Instead of "mode lines", I would prefer what someone else suggested:

	Extend the $HOME/.exrc to include "startup actions" based
	on filename pattern matches, like "*.c) set autoindent"

Whatever you do, make SURE that it is ONLY the person who executes "vi"
that gets to say what it does. This seems to necessarily imply data in a
separate file, probably in $HOME. The use of "./.exrc" is full of more
Trojan Horse problems. Don't include it. But note that the filename
patterns in $HOME/.exrc could include slashes:

	*/man/*)	set para=QSQEBSBELPPPRTIPDSDEFSFE
	*/src/*)	set autoindent showmatch nowrap

That only works if you're OUTSIDE the directory, but using 'csh' patterns,
you could even say

	if($cwd =~ */man/*) set para=QSQEBSBELPPPRTIPDSDEFSFE
	if($cwd =~ */src/*) set autoindent showmatch nowrap

or	if($fullpath =~ ...) ...

The point is, there are LOTS of ways to get the functionality, without
the (1) security problems, and (2) making textfiles suddenly be editor
dependent (I use 'vi' MOST of the time, but also use 'ed', 'screen', etc.).

Rob Warnock

UUCP:	{ihnp4,ucbvax!amd70,hpda,harpo,sri-unix,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphin Drive, Redwood City, CA 94065



More information about the Comp.bugs.4bsd.ucb-fixes mailing list