/dev/blog
Bez Hermoso, Software Engineer @ Square
If you want to paste the contents of a named register without exiting Insert mode, hit <C-r>
, and then the register name.
For example, <C-r>1
will paste the text that was most recently deleted, <C-r>0
will paste the text that was most recently yanked, <C-r>q
will paste the contents of the q
macro, etc.
This also works while in Comand-line mode, too:
:%s/(... hit <C-r>0 to paste in yanked text to replace ...)/<replacement text>/g
Alternately, you can just do
<C-o>p
to paste from within Insert mode. (Hitting<C-o>
will temporarily bring you to Normal mode for one command and dropping you back into Insert mode right after.)See
:help registers
for more information on what the various registers contain.