How do you delete text without affecting any register?
"_dd
Use the black hole register " before a delete command.
13 results for "black hole register"
"_dd
Use the black hole register " before a delete command.
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
"_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 (
"_dP in visual mode
Use "_dP which deletes the selection into the black hole register and pastes before.
yiww"_ciw\<C-r>0\<Esc>
When you are doing repetitive refactors, cw is fast but it overwrites the unnamed register with the replaced text.
:let @a = ''
Registers persist their contents throughout your Vim session and even across sessions if viminfo or shada is enabled.
"ayv
Using named registers with visual mode lets you store multiple independent snippets simultaneously.
dd
The dd command deletes the entire current line, regardless of where the cursor is positioned on that line.
:help registers
Vim has 10 types of registers, each serving a specific purpose.
"0p in visual mode
When you paste over a visual selection with p, Vim replaces the selection with the register contents — but it also puts the deleted selection into the unnamed
:put {reg}
The :put Ex command always inserts a register's content as a new line below the current line, regardless of whether the register holds characterwise, linewise,
editing #registers #editing #paste #ex-commands #normal-mode
:g/^/t.
The command :g/^/t.
let mapleader = ' ' then nnoremap <leader>key command
The leader key is a configurable prefix for your custom key mappings.