How do I insert the output of any Vim Ex command directly into the current buffer?
The :put =execute('{cmd}') idiom inserts the output of any Vim Ex command as text in your buffer.
category:
registers
tags:
#registers
#ex-commands
#command-line
#normal-mode
How do I edit a recorded macro by modifying it as text in a buffer?
Recorded macros are stored as plain text in registers, but editing them by re-recording is tedious for complex sequences.
category:
macros
tags:
#macros
#registers
#editing
How do I copy an entire line in Vim?
The yy command yanks (copies) the entire current line, including the newline character.
category:
editing
tags:
#editing
#registers
#yank
#normal-mode
How do you edit a previously recorded macro in Vim?
Paste the macro register contents with :let @a=' followed by a to insert the current contents, edit them, and close the quote.
category:
macros
tags:
#macros
#edit
#register
What is the difference between register 0 and register 1 in Vim?
Register 0 always contains the last yanked text.
category:
registers
tags:
#registers
#numbered
#difference
How do I access previous deletions from the numbered registers?
Registers 1-9 contain the last 9 deletions or changes that are at least one line long.
category:
registers
tags:
#registers
#editing
#normal-mode
How do you use registers to exchange two pieces of text?
"adiw then move, "aP and diw
Delete the first word into register a with "adiw, move to the second word, paste register a before with "aP, then delete the remaining original.
category:
registers
tags:
#registers
#exchange
#swap
How do I delete an entire line in Vim?
The dd command deletes the entire current line, regardless of where the cursor is positioned on that line.
category:
editing
tags:
#editing
#delete
#normal-mode
How do I search for visually selected text?
To search for the exact text you have selected in visual mode, yank it and paste it into the search prompt.
category:
search
tags:
#search
#visual-mode
#registers
How do the numbered delete registers work and why does deleted text rotate through registers 1 through 9?
Vim maintains a rotating history of deleted text across registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
How do I save a recorded macro permanently so it persists across Vim sessions?
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
category:
macros
tags:
#macros
#config
#registers
#vimrc
#productivity
How do I copy a named register into the system clipboard without yanking again?
If you already have carefully collected text in a named register, re-yanking just to reach the system clipboard is noisy and error-prone.
category:
registers
tags:
#registers
#clipboard
#command-line
#workflow
How do I append yanked text to an existing register without overwriting it in Vim?
Using an uppercase register letter with any operator appends to the register instead of replacing it.
category:
registers
tags:
#registers
#yank
#delete
#editing
#normal-mode
How do I edit a recorded macro in Vim?
Vim stores macros in registers, which means you can paste a macro's contents into a buffer, edit it as regular text, and yank it back into the register.
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I convert a register's type between characterwise and linewise?
:call setreg('a', @a, 'l')
Registers in Vim have a type — characterwise, linewise, or blockwise — that affects how their contents are pasted.
category:
registers
tags:
#registers
#setreg
#type-conversion
#linewise
How do I append the current line to a register from command line without using yank?
:let @a .= getline('.') . "\n"
Named registers are usually filled with yanks and deletes, but they are also plain variables you can edit with Vimscript.
category:
registers
tags:
#registers
#command-line
#vimscript
#editing
How do I diff two buffers side by side in Vim?
The :windo diffthis command activates Vim's built-in diff mode across all visible windows, highlighting the differences between them.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#editing
How do I copy the most recent yank into a named register without yanking again?
When you want to preserve a valuable yank before doing destructive edits, copying register 0 into a named register is safer than re-yanking text.
category:
registers
tags:
#registers
#yanking
#editing
#command-line
#refactoring
How do I insert the unnamed register literally in Insert mode without auto-indent side effects?
In Insert mode, plain {register} inserts register content but may reindent or auto-format depending on context.
category:
registers
tags:
#registers
#insert-mode
#editing
#indentation
#text
How do I copy a register to another register while preserving its character/line/block type?
:call setreg('q', getreg('a'), getregtype('a'))
Simple register copies can silently change behavior when register type is lost.
category:
registers
tags:
#registers
#macros
#command-line
#editing