How do I paste a register literally in insert mode without triggering auto-indent or special key handling?
Answer
<C-r><C-r>x
Explanation
When you press <C-r>x in insert mode to paste a register, Vim inserts the text "as if you typed it" — meaning autoindent, textwidth, and other insert behaviors can alter the pasted content across newlines. Using <C-r><C-r>x (double Ctrl-R) bypasses this by inserting the register's contents literally, exactly as stored.
How it works
<C-r>in insert mode prompts for a register name (you see"on the command line)- A second
<C-r>switches to literal mode before you type the register name xis any valid register:a–z,0–9,",+,*,/, etc.
The standard <C-r>x processes text through Vim's insertion machinery: autoindent adds indentation after newlines, textwidth may wrap long content. With <C-r><C-r>x, the register is inserted byte-for-byte — equivalent to p in Normal mode but without leaving insert mode.
Example
If register a contains a multi-line block yanked from a deeply indented scope:
return {
"key": "value"
}
With autoindent on and cursor at column 0, <C-r>a may add extra indentation to lines 2 and 3. Using <C-r><C-r>a preserves the original whitespace exactly.
Tips
<C-r><C-o>xis a related variant: inserts as if frompin Normal mode, adjusting indentation like]p- Works with special registers:
<C-r><C-r>/pastes the last search pattern literally - This matters most for multi-line content in files with
autoindent,smartindent, orindentexpractive - See
:help i_CTRL-R_CTRL-Rfor full documentation