Path: utzoo!attcan!uunet!aspect!dave From: dave@aspect.UUCP (Dave Corcoran) Newsgroups: comp.editors Subject: Re: Typing long commands in vi Summary: my $.02 worth Message-ID: <3672@aspect.UUCP> Date: 13 Aug 90 15:13:12 GMT References: <56433@microsoft.UUCP> Organization: Aspect Telecommunications, San Jose, Ca Lines: 69 In article <56433@microsoft.UUCP>, steveha@microsoft.UUCP (Steve Hastings) writes: > The other way uses named buffers and the @ command. The @ command executes > a command stored inside a named buffer. So open a new line right in your > source text, type the command then and there, and use the yank command to > put it in a named buffer. Once it is in there, execute the command as many > times as you want with @. If you made a typing error or want to change the > command, edit the line and yank it again. If you deleted the original > line, paste that buffer back in, edit it, and yank it again. All is fine unless the macro chokes: I have one objection to using the technique of putting editing macro in a register (say z) and using @z to invoke it. The vi (visual interface) I use gobbles the macro if an error was encountered during execution and I cannot retrieve it with "zp I offer the following to those who are interested. It is straightforward although it has the distinct disadvantage of only allowing ex commands (as opposed to vi). You could cause the ex macro to store a vi string in a register and then invoke it via @z. In order to get this to work create a 3 line file in your current directory named mac.ex which looks like this. ---------------------cut here----------------------- "+ "- ----------------------cut here---------------------- then type ]m edit any number of lines between the "+ and "-. Then type [m to store the macro and ]e to execute it. Put this in your .exrc. (This is the cat -v version) ---------------------- cut here---------------------- "general purpose maps " "store macro :map [m ?^"^V^M:.,/^"-/w! mac.ex^V^M:.,/^"-/d^V^M " "retrieve macro :map ]m :r mac.ex^V^M " "execute macro :map ]e :so mac.ex^V^M ---------------------- cut here---------------------- -- -- David Corcoran -@@ uunet!aspect!dave ~ Good, fast, cheap; pick any two.