Vim paste before cursor

Viewed 952

I have a selection in a register that includes no new lines. For example:

Happy-

I would like to paste this selection at the start of a line. Say for example:

New-Year

To result in:

Happy-New-Year

Since New-Year is at the start of a line, the leftmost I can place my cursor is over the N:

[N]ew-Year

If I press p in normal mode, I get the following:

NHappy-ew-Year

Is there a variation to p that I can use to paste before my cursor?

2 Answers

As often, capitalization makes the difference: p pastes after, P pastes before.

Yes, you can paste a selection before your cursor by using [p in normal mode. If your cursor is on N:

[N]ew-Year

And you have Happy- in your default register, [p will result in:

Happy-New-Year

This can also be applied to non-default registers. For example, if Happy- is in register a you can paste before the cursor by executing: "a[p

Related