Answer
<C-r><C-o>a
Explanation
When you paste multiline snippets from a register while in Insert mode, default insertion can trigger indentation and formatting side effects line by line. That is often undesirable for preformatted text, logs, or code you want to preserve exactly. The CTRL-R CTRL-O form inserts from a register in a more literal way and avoids those autoindent surprises.
How it works
<C-r><C-o>a<C-r>starts register insertion from Insert mode<C-o>switches to the variant that inserts the register more literallyais the register name (ain this example)
Compared with plain <C-r>a, this is safer when the current buffer has aggressive indent settings or format options.
Example
Suppose register a contains:
if ready:
print("raw")
At an insert position in an indented block, using <C-r>a may reindent or reshape the pasted lines depending on local settings. Using:
<C-r><C-o>akeeps the register text closer to its original form.
Tips
- Use
<C-r><C-p>{reg}when you want Vim to adjust indent to the current context - This works for numbered registers and named registers alike
category: registers tags: #registers #insert-mode #formatting #indentation #editing
Next
How do I join a wrapped paragraph into one line without manual cursor moves?
Related Tricks
How do I paste the unnamed register after transforming it to uppercase?
:put =toupper(@")
How do I paste multiline clipboard text as a comma-separated list in Insert mode?
<C-r>=substitute(getreg('+'), '\n\+', ', ', 'g')<CR>
How do I search literally for the exact text I yanked last?
:let @/ = '\V' . escape(@0, '\')
How do I insert a timestamp computed by Vimscript directly from Normal mode?
"=strftime('%Y-%m-%d %H:%M')<CR>p
How do I copy my most recent yank from register 0 into the system clipboard register?
:let @+ = @0
