rickc@agora.UUCP (Rick Coates) (07/13/89)
First, I thought that the Turing machine simulation in vi is clever - a real tour de force. When I tried it on MKS vi (I would give you a version number if their documentation gave one), however, it bombed. Upon investigation, it is the map k ^V|D (where ^V is the control V character) line that is causing trouble. Then, I tried it from inside unix vi (instead of :so). No luck. Even with 'remap' set, unix vi gives the message I got from MKS - 'missing rhs'. What gives here? Another question - what's the easiest way to globally append/insert text on the end/beginning of lines? I don't know how to do it in vi at all - and in ex it's clumsy. Rick Coates Consulting H/W - S/W engineer (Graphics - Sun - Unix - ASIC design - imbedded systems) ...!tektronix!reed!percival!agora!rickc
larry@macom1.UUCP (Larry Taborek) (07/17/89)
From article <1570@agora.UUCP>, by rickc@agora.UUCP (Rick Coates): > > Another question - > what's the easiest way to globally append/insert text on the > end/beginning of lines? > I don't know how to do it in vi at all - and in ex it's clumsy. > > Rick Coates No problem Rick, The up carrot '^' means the beginning of a line, so to globally insert text at the beginning of a line try... :%s/^/this is to be inserted/g The dollar symbol means the end of a line, so use the following... :%s/$/this is to appended/g Hope this helps. -- Larry Taborek ..!uunet!grebyn!macom1!larry Centel Federal Systems larry@macom1.UUCP 11400 Commerce Park Drive Reston, VA 22091-1506 703-758-7000
hitz@auspex.auspex.com (Dave Hitz) (07/26/89)
In article <1570@agora.UUCP> rickc@agora.UUCP (Rick Coates) writes: > > >First, I thought that the Turing machine simulation in vi is clever - >a real tour de force. > >When I tried it on MKS vi (I would give you a version number if their >documentation gave one), however, it bombed. Upon investigation, >it is the > >map k ^V|D > >(where ^V is the control V character) >line that is causing trouble. Then, I tried it from inside unix vi (instead >of :so). No luck. Even with 'remap' set, unix vi gives the message I >got from MKS - 'missing rhs'. > >What gives here? >...!tektronix!reed!percival!agora!rickc What the "k" map does is clear the current line. The '|' key with no arguments moves to the beginning of the current line, and 'D' clears the rest of the line. However, in ex mode, the '|' character is a command seperator, so to get it into the map itself, I quote it with ^V. Since MKS vi is complaining that there is no right hand side of the macro, it sounds like it didn't handle the quoting correctly, and interpreted the '|' as the end of the map. The TM macros are very senstive to the exact behavior of vi. In fact, they rely on a number of bugs in vi. I've been amazed that they run on all UNIX derived versions of vi that I've used, but not surprised that a new implementation of vi would break with them. Why don't you send MKS the macros and tell them their vi just isn't up to snuff if it can't run them? -- Dave Hitz home: 408-739-7116 UUCP: {uunet,mips,sun,bridge2}!auspex!hitz play: 408-970-8970