home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10715 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  2.7 KB

  1. Xref: sparky comp.unix.questions:10715 comp.editors:2144
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!jvnc.net!rutgers!modus!gear!cadlab!martelli
  3. From: martelli@cadlab.sublink.org (Alex Martelli)
  4. Newsgroups: comp.unix.questions,comp.editors
  5. Subject: Re: vi (cut and paste)
  6. Keywords: vi
  7. Message-ID: <1992Sep02.134055.11787@cadlab.sublink.org>
  8. Date: 2 Sep 92 13:40:55 GMT
  9. References: <3815@keele.keele.ac.uk> <1992Aug17.200149.7817@s912%bnf.com> <515@alden.UUCP>
  10. Organization: CAD.LAB S.p.A., Bologna, Italia
  11. Lines: 62
  12.  
  13. sgr@alden.UUCP (Stan Ryckman) writes:
  14.  
  15. :In article <1992Aug17.200149.7817@s912%bnf.com> bibb@s912%bnf.com (Ken Bibb) writes:
  16. :>In <3815@keele.keele.ac.uk> phd85@seq1.keele.ac.uk (D.H. Holden) writes:
  17. :>> hi, 
  18. :>>    Does anyone know how you cut a range of text to one
  19. :>>    of the named buffers, where the range does not cover
  20. :>>   an integer number of lines, i.e., 
  21. :>>  How do i cut from here > text  text text ..........
  22. :>>  ............... n number of lines .....
  23. :>> ...... to here <  into the named buffer "a for example?
  24. :>>    Cheers,
  25. :>>              Dave.
  26. :>In the following texT:
  27. :>aaabbbbbb
  28. :>bbbbbbbbb
  29. :>bbbbccccc
  30. :>
  31. :>I'll assume you want to cut the b's out and save them into buffer a.
  32. :>1) position the cursor at the beginning of the range to be cut (1Gfb will work
  33. :>   in this example).
  34. :>2) ma (mark the location with marker a)
  35. :>3) move to the end of the range (Gfc will work in this example)
  36. :>4) "ad`a will cut the range and put it into buffer a
  37. :
  38. :NOT!
  39. :
  40. :This grabs all three full lines.  (I tried it!  Did you?)
  41.  
  42. You are wrong.  Yes, I did try Ken's suggestion, and it works perfectly!
  43. Your mistake is probably that sub 4), where Ken specifies a ` (reverse
  44. quote) you used a ' (quote); THAT would grab the three full lines!
  45.  
  46. :Dave presumably wants to have the remaining text be:
  47. :aaaccccc
  48. :
  49. :and the buffer to contain:
  50. :bbbbbb
  51. :bbbbbbbbb
  52. :bbbb
  53.  
  54. Which is EXACTLY what Ken's sequence does.
  55.  
  56. :"Mark" (the "m" command) only marks the line, NOT the cursor
  57. :position within the line.
  58.  
  59. You are wrong.  m DOES mark the column position within the line; then,
  60. if you use a ' (quote) to get back to the mark, you'll use the full
  61. marked line, but if you use a ` (backquote) you'll get the exact
  62. portion of the line.
  63.  
  64. :Am cross-posting to comp.editors, since someone there may know
  65. :for sure whether there _is_ a way to do this, and if I'm wrong I'd
  66. :like to know.  But please, _TRY_ it before posting!
  67.  
  68. The cross-posting was a good idea, since I'm reading this in
  69. comp.editors.  And yes, I do know for sure, and YES, I *DID*
  70. try the exact sequence of commands which you claim fail, and
  71. they work like a charm.
  72. -- 
  73. Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
  74. CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 
  75.