How do I paste from a register while staying in insert mode?
Answer
<C-r>{register}
Explanation
Pressing <C-r> followed by a register name in insert mode inserts the contents of that register at the cursor position without leaving insert mode. This is faster than escaping to normal mode, pasting, and re-entering insert mode.
How it works
- While in insert mode, press
<C-r>— Vim displays a"in the status line, waiting for a register name - Type the register character:
a-zfor named registers,0for the yank register,+for the system clipboard,"for the unnamed register, etc. - The register contents are inserted at the cursor as if you had typed them
Example
You yanked the word configuration into register a with "ayiw. Now you're typing a new line in insert mode:
The | file needs updating
Press <C-r>a and the text becomes:
The configuration| file needs updating
You never left insert mode.
Tips
<C-r>"pastes from the unnamed (default) register — the last yanked or deleted text<C-r>0pastes from the yank register — specifically the last yanked text, ignoring deletes<C-r>+pastes from the system clipboard<C-r>/pastes the last search pattern — useful when building a related search or substitution<C-r>=opens the expression register for on-the-fly calculations- Use
<C-r><C-r>{register}to insert the register contents literally, without interpreting special characters like<CR> <C-r><C-o>{register}inserts the text without triggering abbreviations or auto-indent — useful for pasting code