Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.editors    |    What? Edlin ain't good enough for you?    |    123,932 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 123,467 of 123,932    |
|    Geoff Clare to Janis Papanagnou    |
|    Re: Languages to extend editors    |
|    04 Jun 24 14:43:01    |
   
   From: geoff@clare.See-My-Signature.invalid   
      
   Janis Papanagnou wrote:   
      
   > Don't understate the 'ex' editor (or 'ex'-mode in Vi). You can do   
   > powerful things out of the box that you cannot do in normal mode!   
      
   Indeed, and if you combine the two you can do some amazing things.   
      
   I wrote some vi macros in 1991 for manipulating rectangular blocks.   
   They relied heavily on a technique whereby an ex command is   
   constructed on the fly using normal commands and then deleted into   
   a buffer and the buffer is executed. (I know vim has a built-in   
   feature to do this, but I wrote the macros a couple of years before   
   vim was ported to UNIX.)   
      
   Here's the "block delete" macro which deletes a rectangular block   
   from marked position `a as top left to `b as bottom right (ESC   
   represents an escape character):   
      
   map *d =*I:'a,'bs/ESCA\(.*\)/\1\3/ESC"xdd@x   
      
   It uses this =* helper macro (which also uses the same technique)   
   to create a "line divider" of the form \(...\)\(...\) :   
      
   map =* `a=.xI:s/^ESCA/\\(&\\)\\(/ESC"xdd`b=.@xA\)ESC   
      
   and this in turn uses an =. helper macro to create a line of "."s of   
   length equal to the current column position (^M is a RETURN character):   
      
   map =. mx:t.^M`xjaxESCD:s/././g   
      
   The "block copy" macro is even more complicated. It constructs a set   
   of ex commands to be applied, one per line, to a set of target lines,   
   and executes them using a single ex command of this form ('y marks the   
   line to which the next command should be applied):   
      
   :{range}g/^/d x|'y@x|'y+ma y   
      
   The full set of macros, along with many other sets of amazing vi macros,   
   were in the "comp.editors VI Archives" which can probably still be found   
   at one or more of the sites listed at   
      
   http://www.faqs.org/faqs/editor-faq/VI-Archive-filelist/   
      
   --   
   Geoff Clare
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca