home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.questions:10187 comp.editors:2038
- 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
- From: sgr@alden.UUCP (Stan Ryckman)
- Newsgroups: comp.unix.questions,comp.editors
- Subject: Re: vi (cut and paste)
- Keywords: vi
- Message-ID: <515@alden.UUCP>
- Date: 19 Aug 92 16:40:04 GMT
- References: <3815@keele.keele.ac.uk> <1992Aug17.200149.7817@s912%bnf.com>
- Sender: usenet@alden.UUCP
- Followup-To: comp.unix.questions
- Organization: Alden Electronics, Westboro, MA
- Lines: 63
-
- In article <1992Aug17.200149.7817@s912%bnf.com> bibb@s912%bnf.com (Ken Bibb) writes:
- >In <3815@keele.keele.ac.uk> phd85@seq1.keele.ac.uk (D.H. Holden) writes:
- >> hi,
- >> Does anyone know how you cut a range of text to one
- >> of the named buffers, where the range does not cover
- >> an integer number of lines, i.e.,
- >> How do i cut from here > text text text ..........
- >> ............... n number of lines .....
- >> ...... to here < into the named buffer "a for example?
- >> Cheers,
- >> Dave.
- >In the following texT:
- >aaabbbbbb
- >bbbbbbbbb
- >bbbbccccc
- >
- >I'll assume you want to cut the b's out and save them into buffer a.
- >1) position the cursor at the beginning of the range to be cut (1Gfb will work
- > in this example).
- >2) ma (mark the location with marker a)
- >3) move to the end of the range (Gfc will work in this example)
- >4) "ad`a will cut the range and put it into buffer a
-
- NOT!
-
- This grabs all three full lines. (I tried it! Did you?)
-
- Dave presumably wants to have the remaining text be:
- aaaccccc
-
- and the buffer to contain:
- bbbbbb
- bbbbbbbbb
- bbbb
-
- "Mark" (the "m" command) only marks the line, NOT the cursor
- position within the line.
-
- In this trivial example, the following works:
- 1) position to the beginning as Ken suggests (1Gfb);
- 2) type the command "ad/c
- which will delete up to the first "c" character, putting the
- deletions into the buffer.
-
- However, in the general case this doesn't work; suppose you
- want all the b's PLUS the first c to be cut. Then,
- "ad2/c
- won't work (vi doesn't allow a number before the / command).
- Yes, here you could do
- "ad/cccc$
- and, in most cases, something can be found to work. But to my
- mind, there's no way to put the cursor at one arbitrary mid-line
- point, type something, then position to another arbitrary mid-line
- point, and then delete the in-between-text into a named buffer.
-
- Am cross-posting to comp.editors, since someone there may know
- for sure whether there _is_ a way to do this, and if I'm wrong I'd
- like to know. But please, _TRY_ it before posting!
-
- Stan.
- --
- This .signature has expired. Call 1-900-YOU-FOOL to find out why.
- Stan Ryckman sgr@alden.UUCP
-