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

  1. Xref: sparky comp.unix.questions:10187 comp.editors:2038
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!news.byu.edu!news.mtholyoke.edu!nic.umass.edu!m2c!jjmhome!alden!alden.UUCP
  3. From: sgr@alden.UUCP (Stan Ryckman)
  4. Newsgroups: comp.unix.questions,comp.editors
  5. Subject: Re: vi (cut and paste)
  6. Keywords: vi
  7. Message-ID: <515@alden.UUCP>
  8. Date: 19 Aug 92 16:40:04 GMT
  9. References: <3815@keele.keele.ac.uk> <1992Aug17.200149.7817@s912%bnf.com>
  10. Sender: usenet@alden.UUCP
  11. Followup-To: comp.unix.questions
  12. Organization: Alden Electronics, Westboro, MA
  13. Lines: 63
  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. Dave presumably wants to have the remaining text be:
  43. aaaccccc
  44.  
  45. and the buffer to contain:
  46. bbbbbb
  47. bbbbbbbbb
  48. bbbb
  49.  
  50. "Mark" (the "m" command) only marks the line, NOT the cursor
  51. position within the line.
  52.  
  53. In this trivial example, the following works:
  54. 1) position to the beginning as Ken suggests (1Gfb);
  55. 2) type the command "ad/c
  56.    which will delete up to the first "c" character, putting the
  57.    deletions into the buffer.
  58.  
  59. However, in the general case this doesn't work; suppose you
  60. want all the b's PLUS the first c to be cut.  Then,
  61.    "ad2/c
  62. won't work (vi doesn't allow a number before the / command).
  63. Yes, here you could do
  64.    "ad/cccc$
  65. and, in most cases, something can be found to work.  But to my
  66. mind, there's no way to put the cursor at one arbitrary mid-line
  67. point, type something, then position to another arbitrary mid-line
  68. point, and then delete the in-between-text into a named buffer.
  69.  
  70. Am cross-posting to comp.editors, since someone there may know
  71. for sure whether there _is_ a way to do this, and if I'm wrong I'd
  72. like to know.  But please, _TRY_ it before posting!
  73.  
  74. Stan.
  75. --
  76. This .signature has expired.  Call 1-900-YOU-FOOL to find out why.
  77.     Stan Ryckman   sgr@alden.UUCP
  78.