I always use the following commands to yank an inner word and then paste it in the line above: yiw -> O -> Esc -> p

Obviously P by itself (without using O to insert a line above) doesn't work, because there's no new line character, so instead that just pastes it before the cursor.

Is there an easier way to do this?


2 Answers 2


Two suggestions to paste the contents on a line of its own:

  1. You can use the :put! command, since it always works linewise. The version with the ! inserts the contents of the register before (rather than after) the current line. (You can abbreviate it to :pu!.)

  2. You can use O, Ctrl+R, ", Esc to insert a line above with the contents of the latest yank. See help on i_CTRL-R for the Ctrl+R part. And " is the "unnamed" register, which is where yanks and deletes go by default. This is not necessarily "easier" than O, Esc, p, but it has the advantage that it's a single command, so it's repeatable with . and the whole action can be undone at once.

If this is a frequent enough operation for you, consider creating a mapping for it, that would be surely the easiest one to type. :-)

  • 4
    I think [P or a similar command forces linewise putting. (The think is because i use tpope’s unimpaired which maps that key, and I can’t remember the exact original linewise-put key.) Commented Jun 5, 2019 at 13:07
  • 2
    lowercase p worked for me to put above line [p Commented Jan 26, 2022 at 18:06
  • 1
    For more information on the phenomenal [p and ]p issue :h ]p.
    – mcp
    Commented Feb 18, 2022 at 0:11

I needed to "cast" register contents into a certain (characterwise / linewise / blockwise) mode so often, I wrote the UnconditionalPaste plugin for it. It provides gcp, glp, etc. alternatives to the built-in paste commands that force a certain mode (and by now several more variations on this theme, like pasting with joined by commas or queried characters).

With it, you can just use glp / glP to paste after / before the current line, regardless of how you've yanked the text (i.e. also when it just contains an incomplete line fragment).

You must log in to answer this question.

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