Path: utzoo!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!ucla-cs!gast From: gast@lanai.cs.ucla.edu Newsgroups: comp.editors Subject: Re: Vi map help needed Message-ID: <1991Mar9.053949.9736@cs.ucla.edu> Date: 9 Mar 91 05:39:49 GMT References: <1991Mar04.162508.352@ddsw1.MCS.COM> <1991Mar5.052326.12313@cs.ucla.edu> <1991Mar06.004617.19066@vpnet.chi.il.us> Sender: usenet@cs.ucla.edu (Mr. News Himself) Organization: UCLA Computer Science Department Lines: 64 Originator: gast@lanai.cs.ucla.edu Nntp-Posting-Host: lanai.cs.ucla.edu In article <1991Mar06.004617.19066@vpnet.chi.il.us> dattier@vpnet.chi.il.us (David W. Tamkin) writes: >gast@maui.cs.ucla.edu (David Gast) wrote in <1991Mar5.052326.12313@cs.ucla.edu>: >| In article <1991Mar04.162508.352@ddsw1.MCS.COM> dattier@ddsw1.MCS.COM >| (David W. Tamkin) writes: >| >:map K :%s/ctrl-Vctrl-Vctrl-Vctrl-Vctrl-Vctrl-M//ctrl-Vctrl-Mctrl-M I confess that I did not read the above as carefully as I should have. I saw the typical ^ used as control key later in your posting and then saw a lot of letters after the slashes and wondered what the hay? I also, although I don't know why, interpreted some of the V's as \/. After rereading your original posting I see you were just using user friendly notation--that is, the notation used by the original sender. I was not wondering about the purpose of two slashes together; I couldn't see why they would be in the middle of the :s command rather than at or near the end. I see now that it is only the unusual (but user friendly) notation that threw me off. >Also, even if it did work, typing X (I wouldn't use X myself because the >start-up definition of X is too useful for me to map away) would cause the >cursor to go the bottom of the screen, print out the command, and sit there >waiting for me to press CR. I used X because it frequently means pick any value you want. Forgive me. Anyway, I hardly ever use X when I am typing because hx (or dh) is faster to type than shift-X. There might be a use for X, however. You are correct that the implicit ^M at the end of my macro was not shown--I think it was because of the way I transfered the macro from one window to the other with X (or is that hx? :-) .) I know that I did not type a return to execute it at any rate. In actuality, I would probably bind this map to a function key. >| Further, I do not think you want to put too many ^Vs in or they will be >| taken literally, not as escape characters. >If your vi or your Unix is such that the above mapping would work, then yes, >the one I suggested would fail, for some of the ^V's would be taken lite- >rally. I interpreted your posting to say that the user could use 5 or 7 ^V's and it would not make a difference. My point was that it probably would. (I don't know the precise implementation being used). Anyway, here is the interesting part and the reason for my posting. I tried the exact same map last night via modem and I got all sorts of odd error messages, but sometimes it worked. I also tried it today. Sometimes weird error messages; sometimes it worked; still others it worked but provided a weird error message as well. To make matters odder, one session and the same map frequently gave more than one response with the same input data. My conclusion is that there seems to be some bug in vi for this problem and I would recommend that you use ex (or tr or sed or some other command) unless you are sure you have a non-buggy vi. And I would suggest that if possible you make this filter part of the software you use for getting CPM files. (A couple days ago we had a system crash and it appears that one of the versions of vi we had was lost. My previous posting used that vi, this posting uses the other vi.) David