How do I quickly re-insert the text I just typed without leaving insert mode?
<C-a> (in insert mode)
While in insert mode, pressing re-inserts whatever text you typed during your previous insert session.
197 results for "registers"
<C-a> (in insert mode)
While in insert mode, pressing re-inserts whatever text you typed during your previous insert session.
:<C-r>"
When typing an Ex command or search pattern, you often need to insert text you've already yanked or deleted.
let @a = 'sequence'
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).
:'<,'>copy'>
How it works The :copy command (or its abbreviation :t) duplicates lines to a specified destination.
"#p or <C-r># in insert mode
The # register always contains the name of the alternate file — typically the file you were editing just before the current one.
:echo strtrans(@q)
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
<C-r><C-r>a
In insert mode, a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings.
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
:let @a = "value"
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
:call setreg('"', @", 'l')
Vim registers carry not just their text content but also a type: charwise (c), linewise (l), or blockwise (b).
<C-r>/
Vim stores your last search pattern in the / register.
:m +1
The :move command (abbreviated :m) relocates lines to a new position in the buffer without touching any registers.
"=
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
"0p
Register 0 (the yank register) always contains the text from your most recent yank command — and unlike the unnamed register, it is never overwritten by delet
qQ...q
When you record a macro into register q with qq.
:call setreg('a', @a . 'text', 'l')
How it works Vim provides two functions for advanced register manipulation: setreg() and getreg().
:<C-r>a
How it works While typing an Ex command on the command line (after pressing :), you can insert the contents of any register by pressing Ctrl-R followed by the r
:let @q='commands'
Macros in Vim are stored in registers as plain text.
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
"qp
Macros are stored as plain text in named registers.