Loading ...
Sorry, an error occurred while loading the content.

Re: Repeat change on range

Expand Messages
  • Bohdan Vlasyuk
    ... well, go and select your lines with v or V, and then :g/^/normal 0RAAA
    Message 1 of 11 , May 30, 2001
    • 0 Attachment
      On Wed, May 30, 2001 at 10:13:17AM -0400, Ondrejko, David wrote:

      > Let's say that I have the following text:
      >
      > HHHHHHH
      > BBBBBBB
      > NMNMNMN
      > QQQQQQQ
      >
      > I go to the first 'H' and type RAAA<ESC> Is there a way to visually
      > select the next three lines and repeat the previous change on each
      > of those lines? Maybe something using the :s command? (WITHOUT
      > having to type the change in again, I mean; the actual change is a
      > little longer.)
      well, go and select your lines with v or V, and then :g/^/normal 0RAAA
    • Ondrejko, David
      ... That actually comes closest to what I want to accomplish, yes. Thanks! I never thought of repeating the last command within the recording of a macro.
      Message 2 of 11 , May 30, 2001
      • 0 Attachment
        RE: Repeat change on range

        > <Trimmed>
        >
        > The other thing to do is make a macro, like qa.j0q
        > and then go to the next line you want to change and
        > execute it with @a.  To do several lines in a row,
        > for example the next 3, just do 3@a

        That actually comes closest to what I want to accomplish, yes.  Thanks!  I never thought of repeating the last command within the recording of a macro.

      • Benji Fisher
        ... Here s another alternative. Make your change, then select the lines you want to change in Visual mode, and do ... The range,
        Message 3 of 11 , May 30, 2001
        • 0 Attachment
          > "Ondrejko, David" wrote:
          >
          > > <Trimmed>
          > >
          > > The other thing to do is make a macro, like qa.j0q
          > > and then go to the next line you want to change and
          > > execute it with @a. To do several lines in a row,
          > > for example the next 3, just do 3@a
          >
          > That actually comes closest to what I want to accomplish, yes. Thanks!
          > I never thought of repeating the last command within the recording of a
          > macro.

          Here's another alternative. Make your change, then select the lines
          you want to change in Visual mode, and do

          :'<,'>normal .

          The range, '<,'> , gets inserted automatically. You might want to put a
          motion before the . if the change is not supposed to be at the start of
          the line.

          Yet another possibility is to start recording before you make the
          first change.

          HTH --Benji Fisher
        • Coen Engelbarts
          ... AHA! So THAT is why that :
          Message 4 of 11 , May 31, 2001
          • 0 Attachment
            > Here's another alternative. Make your change, then
            > select the lines
            > you want to change in Visual mode, and do
            >
            > :'<,'>normal .
            >
            > The range, '<,'> , gets inserted automatically. You might

            AHA! So THAT is why that :'<,'> always pops up its ugly head when I enter
            command mode!
            Probably, when I click the mouse in my GUI VIM window to make it active, I
            sometimes inadvertently select some text.
            If I then enter command mode, the :'<,'> is already there.

            And I thought it was just bad karma. ;-)

            Before I start asking silly questions about this, where can I find the help
            text on this eh... feature?

            Thanks in advance,

            Coen
          • Ondrejko, David
            ... When I do that, all it says is 11 lines yanked (or however many lines I selected). I was getting the same message yesterday when I was trying something
            Message 5 of 11 , May 31, 2001
            • 0 Attachment
              RE: Repeat change on range

              >      Here's another alternative.  Make your change,
              > then select the lines you want to change in Visual
              > mode, and do
              >
              > :'<,'>normal .

              When I do that, all it says is '11 lines yanked' (or however many lines I selected).  I was getting the same message yesterday when I was trying something else along these lines, though I can't remember exactly what I was trying.  Any idea why?

              -- Davyd

            Your message has been successfully submitted and would be delivered to recipients shortly.