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

Re: yanking non-contiguous lines?

Expand Messages
  • Marcin Szamotulski
    ... assuming that AAA is on the line 1 and we are coping thing to the end of file. As you can see the g command is not very handy to do that. Another way is
    Message 1 of 5 , Oct 7, 2013
    • 0 Attachment
      On 14:39 Mon 07 Oct , Chris Lott wrote:
      > Assuming Vim without plugins like YankRing or the like, what is the
      > fastest way to copy non-contiguous lines to another place in the
      > document, such as a document:
      >
      > AAA
      > BBB
      > CCC
      > DDD
      >
      > That I want to become
      >
      > AAA
      > BBB
      > CCC
      > DDD
      >
      > AAA
      > CCC
      > DDD
      >
      > Thanks!
      >
      > c
      > --
      > Chris Lott <chris@...>

      Here is one possible solution:
      :g/\%1l\|\%3l\|\%4l/t$
      assuming that AAA is on the line 1 and we are coping thing to the end
      of file. As you can see the g command is not very handy to do that.
      Another way is to go to AAA and copy to a register, let say 'a' (with
      normal command "aY) and then go to the next line and copy it with "AY
      (which means append to the register a). You can also use visual
      selection if it makes it easier. And then paste from the register a.

      Best regards,
      Marcin

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Dimitar DIMITROV
      ... This is what I would do: qaq to clear register a then go to every line you want and copy it with Ayy (capital A for appending) Eventually, I would use ap
      Message 2 of 5 , Oct 8, 2013
      • 0 Attachment
        >Assuming Vim without plugins like YankRing or the like, what is the
        >fastest way to copy non-contiguous lines to another place in the
        >document, such as a document:
        >
        >    AAA
        >    BBB
        >    CCC
        >    DDD
        >
        >That I want to become
        >
        >  AAA
        >  BBB
        >  CCC
        >  DDD
        >
        >  AAA
        >  CCC
        >  DDD
        >
        >Thanks!
        >
        >c
        >--
        >Chris Lott <chris@...>

        This is what I would do:

        qaq to clear register a then go to every line you want and copy it with "Ayy (capital A for appending)
        Eventually, I would use "ap to paste

        Regards

        Dimitar

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
         
        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Marcin Szamotulski
        ... Cool way of clearing a register, I used ... for that qaq is much nicer. Thanks! Marcin -- -- You received this message from the vim_use maillist. Do
        Message 3 of 5 , Oct 8, 2013
        • 0 Attachment
          On 09:09 Tue 08 Oct , Dimitar DIMITROV wrote:
          > >Assuming Vim without plugins like YankRing or the like, what is the
          > >fastest way to copy non-contiguous lines to another place in the
          > >document, such as a document:
          > >
          > >    AAA
          > >    BBB
          > >    CCC
          > >    DDD
          > >
          > >That I want to become
          > >
          > >  AAA
          > >  BBB
          > >  CCC
          > >  DDD
          > >
          > >  AAA
          > >  CCC
          > >  DDD
          > >
          > >Thanks!
          > >
          > >c
          > >--
          > >Chris Lott <chris@...>
          >
          > This is what I would do:
          >
          > qaq to clear register a then go to every line you want and copy it with "Ayy (capital A for appending)
          > Eventually, I would use "ap to paste
          >
          > Regards
          >
          > Dimitar

          Cool way of clearing a register, I used
          :let @a=''
          for that 'qaq' is much nicer.

          Thanks!
          Marcin

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.