how do you get modeline(s) to work under vi?

Brandon S. Allbery allbery at NCoast.ORG
Mon Dec 18 04:45:35 AEST 1989


As quoted from <493 at hades.OZ> by greyham at hades.OZ (Greyham Stoney):
+---------------
| Can anyone provide me with a working example of how to get modelines to
| work under vi?. Our vi (ISC 386/ix) 'set all' shows a 'modelines' option;
| (note that it's plural; the BSD manual I have says it's singular) but I
| can't seem to get it to do anything.
+---------------

"modelines" in vi doesn't mean something on the screen; it refers to the
ability to put ex/vi commands in a file, to be executed when the file is read
in.  The commands must be in the first and/or last 5 lines in the file,
prefixed by "[ev][xi]:" (that is, any of "ex:", "vi:", "vx:", or "ei:"), and
be suffixed with a colon.  ("ex: set autoindent:") (Don't worry, I'm going to
make sure that the above isn't in the first/last 5 lines of this message.)
This option is often disabled by default, since it can be somehting of a
security hole.

Perhaps what you want is the "showmode" option.  This option makes the current
mode show up in the lower right-hand corner of the screen; it's blank in
command mode, or may show one of the following:

				APPEND MODE
				INSERT MODE
				CHANGE MODE
				REPLACE MODE
				REPLACE 1 CHAR

There may be others as well.  This goes a long way toward fixing the biggest
problem with vi:  knowing just exactly what it expects you to be doing.  After
all, you can botch things up royally if you think you're in an input mode and
vi thinks you're in command mode.

++Brandon
-- 
Brandon S. Allbery    allbery at NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi)
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu bsa at telotech.uucp
*(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)*
*Third party vote-collection service: send mail to allbery at uunet.uu.net (ONLY)*
expnet.all: Experiments in *net management and organization.  Mail me for info.



More information about the Comp.unix.i386 mailing list