How to put at end of line with vim?

I would like to use p to put some text at the end of the current line without moving the cursor.


For example I would like to copy a word to the end of the line so I use yw to copy the word and then how can I put it to the end of the current line?

  • 2
    What do you mean?
    – user859
    May 6, 2016 at 10:17
  • 2
    If you want a mapping you could try this: nnoremap ,p m'yiw$p`` . Hit ,p and the word under the cursor should be pasted at the end of the line. You don't need the space at the end, it's here because I don't know how to format code containing a double backtick without it. May 6, 2016 at 11:18

3 Answers 3


If you want your cursor back to its previous position after putting the text at the end of the line you could use marks:

  • ma sets the mark a to the current position
  • $p As explained is the other answers put the text at the end of the line
  • (backtick)a go back to the position marked by ma

You want to "put", not "print".

  1. Move the cursor to the end of the line with $.

  2. Press p to "put" the content of the unnamed register (what you yanked with yw) after the cursor.

See :help p, :help registers, :help :print.

  • yes, put sorry! However I would like to print to the end of line without moving the cursors. Is this possible? May 6, 2016 at 11:05
  • 4
    No. You need to move the cursor to where you want to put.
    – romainl
    May 6, 2016 at 11:06

If I understand correctly, you want to put a word at the end of the line.

You can do that with:


$ move the cursor to the end of the line, p put.

The print command on the other hand, is used to display lines of your file, e.g.

:1,2p "print the first and second line.


  • :h p (put)
  • :h :p (print)

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.