vi puzzle
gbergman at ucbtopaz.CC.Berkeley.ARPA
gbergman at ucbtopaz.CC.Berkeley.ARPA
Sat Sep 8 03:24:51 AEST 1984
One of the more fruitless things one can do in vi is to set up
abbreviations such as
:ab yes yes!
or
:ab O O'Shaughnessy
for as soon as you try to use the abbreviation, the editor goes into an
infinite loop. Under 4.2bsd, ^C is usually successful in quickly
breaking the loop -- at least in regular text; on the bottom line the
results are less predictable.
Problem: suppose you have made such an abbreviation. How can you
undo it without quitting the editor, or leaving vi mode?
(To make this seem realistic, suppose that for some one-time
special piece of editing you are doing, you have set up some 50
different abbreviations over the course of several hours but not put
the commands in a file you can source -- so you don't want to quit the
editor and lose them all. And suppose that you have mapped and ab'ed Q
and ^\ and that the ab's generate infinite loops as above, so you
can't unab or unmap them, and hence cannot go into ex mode. Anyway,
even if you find some flaw in this scenario, the problem is still to
undo such an abbreviation while staying in vi mode -- which includes
the bottom line, of course.)
Mail solutions to me, and in a couple of weeks I will summarize
those that I have received, along with the two that I have found
myself. Please try them before sending them! And mention what version
of the editor and unix you are using. (If you're on 4.1 it may be hard
to break those infinite loops, so you might do best to experiment where
there is a second terminal at hand that you can use to kill the process,
or where you can do so by a hangup. I don't know about other forms of
unix than 4.[12].)
George Bergman
Math, UC Berkeley 94720 USA
...!ucbvax!ucbcartan!gbergman
More information about the Comp.unix.wizards
mailing list