miker@central.sun.com (Mike Raffety) (05/09/89)
It turns out that the "modeline" option is very interesting indeed. If you have this option set (normally it's off) through your environment or your .exrc file (e.g., "set modeline"), ex and vi will check the first five lines and the last five lines of the file that you are editing for text within a line of the form: first character is a tab or space, followed by the letters "ex" or "vi", followed by a colon, followed by a string, terminated by another colon. And THEN, ex/vi will EXECUTE the string when you begin editing that file. For example, add a line like "/* vi:set number: */" to the beginning or end of a file, do a "setenv EXINIT 'set modeline'", and vi the file. Voila! You now have line numbering set BY THE FILE YOU'RE EDITING! The other undocumented vi "set" option is "sourceany", which, when set, permits ex/vi to execute ~/.exrc and/or ./.exrc even when you DON'T own it. Both sound like potential security problems when enabled ...