vimtricks.wiki Concise Vim tricks, one at a time.

How do I paste register contents literally without triggering mappings in insert mode?

Answer

<C-r><C-r>a

Explanation

In insert mode, <C-r>a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings. Using <C-r><C-r>a (double Ctrl-R) inserts the text literally, bypassing any expansion or interpretation.

How it works

  • <C-r>a — insert register a, text is processed as typed keypresses
  • <C-r><C-r>a — insert register a literally, no expansion
  • <C-r><C-o>a — insert literally and don't auto-indent
  • <C-r><C-p>a — insert literally with proper indentation fixing

Example

" Register a contains: dont
" You have abbreviation: iabbrev dont don't

" <C-r>a inserts: don't (abbreviation triggered)
" <C-r><C-r>a inserts: dont (literal, no expansion)
With mapping: inoremap jk <Esc>
Register has: jk
<C-r>a → triggers <Esc> (exits insert mode!)
<C-r><C-r>a → inserts 'jk' literally

Tips

  • Always use <C-r><C-r> when pasting code that might contain mapping triggers
  • <C-r><C-o> is best for pasting code as it also prevents auto-indentation
  • In command-line mode, the same <C-r><C-r> literal paste works
  • Critical when registers contain special sequences like jk, jj, or abbreviation triggers

Next

How do I return to normal mode from absolutely any mode in Vim?