Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 v7 ucbtopaz-1.8; site ucbtopaz.CC.Berkeley.ARPA Path: utzoo!linus!decvax!ucbvax!ucbtopaz!gbergman From: gbergman@ucbtopaz.CC.Berkeley.ARPA Newsgroups: net.text,net.unix-wizards Subject: vi puzzle Message-ID: <545@ucbtopaz.CC.Berkeley.ARPA> Date: Fri, 7-Sep-84 13:24:51 EDT Article-I.D.: ucbtopaz.545 Posted: Fri Sep 7 13:24:51 1984 Date-Received: Sun, 16-Sep-84 07:18:03 EDT Organization: Univ. of Calif., Berkeley CA USA Lines: 37 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