[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inserting text of arbitrary length before rectangular region
From: |
Marc Simpson |
Subject: |
Re: Inserting text of arbitrary length before rectangular region |
Date: |
Thu, 5 Mar 2020 13:01:54 -0800 |
I'd go the traditional vi route,
:.,/Tom/s/^/Name of applicant:
Or if the range wasn't so straightforwardly expressible, you could
mark the first and last lines first (e.g. ma, mb), then
:'a,'b/^/Name of applicant:
/M
On Thu, Mar 5, 2020 at 8:23 AM Paul Fox <address@hidden> wrote:
>
> gerard wrote:
> > I'm having difficulty understanding rectangular regions.
> >
> > Let's say I want to enter the text "Name of applicant: " at the
> > beginning of each line below:
> >
> > John
> > Henry
> > Mike
> > Tom
> >
> > Positioning the cursor at the first character on line 1, I create a
> > rectangular region with 3q3jq
> >
> > I then do c^S and at the prompt I enter "Name of applicant: " (without
> > quotation marks), but only the first letter N is entered.
> >
> > Have I misunderstood what should happen here?
>
> Your expectations were fine, it just doesn't work that way. It
> probably should, but I must have thought it was too hard at the time.
>
> A rectangular 'c'hange command will only operate _inside_ of the defined
> rectangle -- it can't expand that rectangle. There should really be
> a rectangular 'i'nsert command, to do what you're trying to do.
>
> What I do is first open the rectangle I need, either with ^A-r, or
> simply by shift the lines over, mark a corner with 'ma', then go to
> the far corner to change it with 'c`a'. Or you could sweep it out with 'q'.
> If I opened the space too big, I then have to trim it back down.
> Clumsy, I know.
>
> Maybe someone else has a better way.
>
> paul
> =----------------------
> paul fox, address@hidden (arlington, ma, where it's 45.7 degrees)
>
>
Re: Inserting text of arbitrary length before rectangular region, Gerard Lally, 2020/03/06