Xref: utzoo comp.unix.questions:9617 comp.bugs.sys5:609 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions,comp.bugs.sys5 Subject: vi `ei:' (`modeline') Keywords: vi passwd lookout Message-ID: <13905@mimsy.UUCP> Date: 8 Oct 88 00:03:33 GMT References: <3394@dunkshot.mips.COM> <1235@cbnews.ATT.COM> <13215@hqda-ai.ARPA> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 25 In article <13215@hqda-ai.ARPA> jay@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:' or `vi:'. 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@mimsy.umd.edu Path: uunet!mimsy!chris