vi `ei:' (`modeline')
Chris Torek
chris at mimsy.UUCP
Sat Oct 8 10:03:33 AEST 1988
In article <13215 at hqda-ai.ARPA> jay at hqda-ai.ARPA (Jay Hiser) writes:
>... but SysV vi has an interesting bug/feature that can cause a problem.
>
>CCI, our SysV vender, has just posted a bulletin warning that vi has
>an undocumented feature. "[it was] designed to look for the
>occurrence of a line that starts with the string "ei:" and use the
>characters following the ei: as editor commands. This is NOT
>documented."
This bulletin is correct in point of fact but is wrong in spirit.
What really happens is that vi is looking for `mode lines' consisting
of `ex:<commands>' or `vi:<commands>'. Such lines must appear within
the first or last 5 (10?) lines of the file being edited.
Now, the code that checks for `mode lines' is rather sloppy. Not only
does it match on `ex' and `vi', it also matches on `ei' and `vx'. And
in 4.2BSD (and perhaps some SysV releases---no telling which ones since
the release numbering is so bizarre) you cannot turn it off! More modern
vi's have a `modeline' option, so that you must `set modeline' before
editing such a file if you want mode line commands to take effect.
`set nomodeline' in your .exrc or $EXINIT or ./.exrc and the editor
will ignore mode line commands.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list