The trouble seems to be that vi will intercept certain ASCII sequences in
the input file on lines beginning with 'ex:' and will interpret them as if
they were commands.
For example, a file containing the two lines
ex::
ex:3:
will, when read into some versions of vi, produce the diagnostic
"Not that many lines in buffer."
This problem arose when using vi to edit ASCII database files structured into
newline-separated records with the fields separated by colons (a la
/etc/passwd) and where 'ex' was one possible entry in the first field of
a record.
Would someone who is in the know please tell me whether this behavior is
a bug or a "feature"? I certainly cannot find any mention of it in what
little documentation I have about vi (the SysV and BSD man pages on ex and
vi, and a document called "An Introduction to Display Editing using Vi").
Thank you in advance.
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
go for it! allegra,ulysses,vax135}!ttrdc!levy
This is an semi-documented feature:
Mode lines are now supported. Put a line containing
ex: xxx :
in the first or last 5 lines of the file, where xxx is any ex
command you want executed when that file is read in. To make
other programs happy, it should probably be inside a comment. ----+
You can use vi: as well as ex:. (Note: no space allowed |
between the "ex" and ":". The spaces around xxx are considered |
part of the command, and so are optional.) |
|
eg /* ex: autoindent : */ <-+
It was added in version 3.7 (October 16, 1981). This and other goodies
are found in a file ex.news which comes with the vi src. On my machine,
it was in /usr/src/cmd/vi/vax/ex.news which is a vax running SVR2. I don't
know whether or not it is considered proprietary, otherwise I would have
posted it in its entirety.
--
Jim Webb "Out of phase--get help" ...!ihnp4!hropus!jrw
I sure would have preferred that this behavior wasn't the default, requiring
a command line option or environment variable to turn it on, or at the least
that it could be turned off by a command line option or something in the
$HOME/.exrc file. In certain contexts, e.g. editing ASCII database files,
it stinks. I particularly liked the message from the fellow who said that his
version of the vi source code deleted this "feature" by #ifdef SUICIDE
preprocessor directives. (I have now found it, in the routine checkmodeline()
in ex_io.c. Not the #ifdef SUICIDE directive, but rather the suicidal code.)
Dan