How do you delete text without affecting any register?
"_dd
Use the black hole register " before a delete command.
69 results for "dd"
"_dd
Use the black hole register " before a delete command.
dd
The dd command deletes the entire current line, regardless of where the cursor is positioned on that line.
qa/pattern<CR>dd@aq
By starting a macro with a search command, the macro becomes conditional — it jumps to the next match before acting, and terminates when no more matches are f
:call setreg('q', 'dd')
The setreg() VimScript function lets you populate any register with arbitrary content directly from the command line or a script — no recording required.
:let @q = "dd"
Macros are just strings stored in named registers.
:g/pattern/normal dd
The :g/pattern/normal {commands} command executes normal mode keystrokes on every line in the file that matches the given pattern.
"qp {edit} 0"qy$ dd
When you record a macro and realize it has a mistake, the easiest fix is to paste the macro's keystrokes as text, edit them, and yank the corrected version back
:let @q='commands'
Macros in Vim are stored in registers as plain text.
:let @q =
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
:norm! {cmd}
Both :norm and :norm! execute a sequence of Normal mode keystrokes from the command line or a script, but they differ in how they handle user-defined mappings.
"1 through "9
Vim maintains a rotating history of deleted text across registers "1 through "9.
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
:help topic
Vim has an extensive built-in help system.
"1p
Vim automatically stores your deletion history in numbered registers "1 through "9.
qaddpq
Record a macro that deletes the current line with dd and pastes it below the next line with p.
:setlocal nomodifiable
While :set readonly prevents accidental writes, nomodifiable goes further by preventing any changes to the buffer contents entirely.
buffers-windows #buffers-windows #readonly #modifiable #protection
P
The P (uppercase) command pastes the contents of the default register before the cursor position.
p
The p command pastes (puts) the contents of the default register after the cursor.
:move +1 / :move -2
The :move command relocates lines to a specific position without using delete and paste.
"_d{motion}
Vim's black hole register (") acts as a write-only sink: anything sent to it is discarded without affecting any other register, including the unnamed register (