I would like to put the current text in a register onto line 10. How I am doing it now is yanking the text, then going up to that line and then pasting the text, but I'd like to stay on the current line. Is there a way to do something like:

12Gp " paste something onto line 12

Update: it looks like this is answered on StackOverflow: https://stackoverflow.com/a/53115840/651174.

:copy 12
:t 12       " alias


:move 12    " move current line(s) to position
:m 12       " alias

Though it works on the current line(s) or a range, and doesn't necessarily paste what's in the register.

  • See :help :put.
    – Ralf
    Jun 14, 2020 at 21:30
  • @Ralf -- thanks. So :12put would out from the default register. Is there a way to do something like :12put "a ?
    – David542
    Jun 14, 2020 at 21:39
  • :put=@a, but :put adds a line. setline() (IIRC the name of the function) replaces the lines. See :h functions(), here are plenty. Jun 14, 2020 at 23:13

1 Answer 1


Use :put.

To put the content of register a below line 12:

:12put a

To put the content of register a before line 12 add the exclamation mark:

:12put! a

BTW: Put can also be used with strings or variables:

:12put ="Below 12"
:let x="Also below 12"
:12put =x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.