home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / editors / 2810 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  4.2 KB

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!rpi!uwm.edu!rutgers!modus!gear!cadlab!martelli
  2. From: martelli@cadlab.sublink.org (Alex Martelli)
  3. Newsgroups: comp.editors
  4. Subject: Re: VI??? GROSS!
  5. Message-ID: <1992Nov17.082134.13232@cadlab.sublink.org>
  6. Date: 17 Nov 92 08:21:34 GMT
  7. References: <LYT86XN@math.fu-berlin.de> <1992Nov12.232530.18958@wixer.cactus.org> <1992Nov13.124435.20019@cas.org> <1992Nov13.152821.6781@nsisrv.gsfc.nasa.gov> <Z8U84BL@math.fu-berlin.de>
  8. Organization: CAD.LAB S.p.A., Bologna, Italia
  9. Lines: 80
  10.  
  11. wolff@inf.fu-berlin.de (Thomas Wolff) writes:
  12.  
  13. :Most repliers to my posting seem to be that well accustomed to the fact 
  14. :that vi is a line editor that they didn't see my point when I wrote 
  15. :"arbitrary (!) block of text" (well, maybe "block" was misleading). This 
  16. :is not a block of lines (which is the unit of most vi operations) and 
  17. :since I referred to "elementary text editing tasks" I didn't mean columns 
  18. :either. Suppose I have the lines
  19. :    word1 word2 word1
  20. :    word3 word4 word3
  21. :and I need the text from "word2 " up to "word4" (assume it's a sentence) 
  22. :to be copied or moved elsewhere.If an editor cannot do this with a 
  23. :simple command sequence (and without the search trick burdening me with 
  24. :the task of counting the occurences of the word following my sentence 
  25. :within my sentence, if it can be done that way at all), I just do not 
  26. :call it a text editor.
  27.  
  28. You don't seem to be READING the responses to your post!
  29.  
  30. 1. Place the cursor on the leading "w" of "word2".
  31.    (by any means whatsoever).
  32.  
  33. 2. Press: ma
  34.    You have thus placed the marker named a on that point.
  35.  
  36. 3. Place the cursor on the final "4" of "word4".
  37.    (again, by any means whatsoever).
  38.  
  39. 4. Press: mz
  40.    You have thus placed the marker named z on that point.
  41.    (note that you have 26 marks at your disposal, named a to z).
  42.  
  43. 5. Press: `a
  44.    You will move to the EXACT point of mark a, the leading w of "word2".
  45.    Note that this is a BACKquote, also known as GRAVE ACCENT, *NOT* an
  46.    apostrophe.  The apostrophe would use the mark for line-oriented
  47.    operation; the backquote uses it for character-stream operation.
  48.    If you don't like this key assignment place a "map ' `" in your
  49.    .exrc, and the apostrophe will start working in charstream too.
  50.  
  51. 6. To COPY, press: "ay`z
  52.    You have thus yanked the EXACT block of text you're interested in,
  53.    into named-buffer a.  Note that a BACKQUOTE is needed here, too,
  54.    before the z, unless you've mapped things to work differently.
  55.    (You have 26 named buffers at your disposal, named a to z).
  56.    (If you *already* had text inside named-buffer a, and you wanted
  57.    to APPEND these words to that, you could do this by pressing:
  58.    "Ay`z - the uppercasing of the buffer name is the trick.  By using
  59.    the buffername in lowercase, the previous contents of the buffer
  60.    are, instead, replaced).
  61.  
  62. 6bis. Or, to MOVE, press: "ad`z
  63.    You have thus *deleted* the exact block of text into the named buffer.
  64.  
  65. 7. Now place the cursor wherever you wanted to place the text.
  66.    (yet again, by any means whatsoever).
  67.  
  68. 8. Press: "ap
  69.    You have put named-buffer a's contents right after the cursorpoint.
  70.    Or, Press: "aP to put the same contents right BEFORE the cursorpoint.
  71.    Note that in either case the contents go within the textstream at
  72.    the cursorpoint, as they have been yanked or deleted as textstream,
  73.    not as whole lines.
  74.  
  75.  
  76. I don't claim this process is perfect.  No immediate visual feedback
  77. is available of where marks are, or what you have yanked.  The use
  78. of both lower and upper case for commands, which are not echoed, is
  79. at first confusing, although the mnemonic relationships make it
  80. rather commodious to use after a while (p-ut after, P-ut before;
  81. "a to overwrite buffer a, "A to append to it; and so on).
  82.  
  83. I *DO* claim that you have flamed the vi editor, and by implication
  84. us, its users, WITHOUT having taken the trouble to learn it AT ALL!
  85. Such characterstream operation, and the backquote movement-command
  86. in particular, are not some sort of "exoterica", but, rather quite
  87. fundamental usage modes of this program!
  88. -- 
  89. Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
  90. CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 
  91.