MAJOR BUG (vi modeline) -- a safe & powerful alternative

mark at elsie.UUCP mark at elsie.UUCP
Thu May 10 21:16:01 AEST 1984


<>
Instead of hacking up vi, or creating various alias that toggle .exrc files,
Why not write your own version of vi for each directory where you want to do
some editing. That is, write a shell script named vi! Here's one I'm using
for a paper I'm working on (^[ == CTRL V ESC; ^letter == CTRL V CTRL letter):

#! /bin/sh
EXINIT='set terse shell=/bin/csh sw=4 wm=4 aw |map! #1 ^V    |map! ^[Ow ^[>>$a|m
ap #1 :w^M:n^M|map #2 :n^M| map #3 :ta |map ^[Oq Gi/\<^[A\>^["zdd at z|map ^[Or 1G!
Gvispell^M'
export EXINIT
exec /usr/local/vi $@

Note that the EXINIT variable needs be a single line (escaped newlines don't
seem to work with sh variables; they do with csh but startup is slower).
I've split the line to let it transmit here. Also this won't work if you
want different options for different files in the same directory, but I find
it useful.

-- 
Mark J. Miller
NIH/NCI/DCE/LEC
UUCP:	decvax!harpo!seismo!rlgvax!cvl!elsie!mark
Phone:	(301) 496-5688



More information about the Comp.unix.wizards mailing list