Assume I have

1 - funct1
2- funct 2
3 - funct 3 
4 line 4

how can I copy line 1 and 3 (not a range of lines) and paste them, for example at line 8? If I do this in way with | arg like ( 1y|3y), I would yank lines to several registers, right? But how can I put from several registers at once?

3 Answers 3


You can append to a register instead of erasing it by using the upper-case letter instead of the lower-case one.

For example:

:1y a      # copy line 1 into register a (erases it beforehand)
:3y A      # copy line 3 into register a (after its current content)
8G  # go to line 8
"ap        # print register a
  • 1
    You can also do this in normal mode with "ayyjj"Ayy"ap.
    – wchargin
    Commented Apr 28, 2016 at 15:35
  • 5
    (or 1G"ayy3G"Ayy8G"ap for explicit line numbers)
    – wchargin
    Commented Apr 28, 2016 at 15:36
  • 1
    Isn't it just G for go to line, not <C-G>?
    – David
    Commented Apr 28, 2016 at 16:38
  • 1
    This is so cool. You can keep adding as many things to buffer A as you want and it'll keep it all. To start over, put something in register a
    – CornSmith
    Commented Apr 28, 2016 at 16:58
  • 1
    @CornSmith Nitpick: buffer is a very specific term in the context of vim. "a is a register.
    – Doorknob
    Commented Apr 29, 2016 at 12:34

You can use the :copy command, which can be abbreviated as :t:


If you want to copy a range of lines (e.g. all lines from 1 to 3) you can do it like this:

  • I want to copy lines by number, but not a RANGE OF LINES... Can i with something like t command append to line? Commented Apr 28, 2016 at 13:25
1Gyy7Gp #use 7 if you wish to paste the line at 8
3Gyy8Gp #use 8 if you wish to paste the line at 9
  • These can be better expressed with the :t command, which also doesn't clear the " or 0 registers.
    – Doorknob
    Commented Apr 29, 2016 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .