How do I cycle through previously deleted text using numbered registers?
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
c in visual mode
Select text visually, then press c to delete the selection and enter insert mode.
d in visual mode
Select text visually and press d to delete the selection.
:call DeleteHiddenBuffers()
Define a function or use a plugin.
:bd 3
Use :bd (bdelete) followed by the buffer number.
"_dd
Use the black hole register " before a delete command.
qa/^$/\ndd@aq
Record a macro that searches for blank lines, deletes them, and recurses.
qa0dwjq
Record a macro that goes to the start of line with 0, deletes the first word with dw, and moves down with j.
qad/pattern\nq
Record a macro that deletes from the cursor to the next match of a pattern using d/pattern.
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
<C-h> / <C-w> / <C-u>
Vim provides three levels of deletion directly in insert mode, so you don't need to switch to normal mode for small corrections.
"1p ... "2p ... "9p
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
<C-w>
Pressing in insert mode deletes the word before the cursor instantly, without requiring you to switch to normal mode.
dap / dip
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
editing #editing #text-objects #normal-mode #delete #motions
di(
The di( command deletes everything inside the nearest pair of parentheses without removing the parentheses themselves.
daw
The daw command deletes a word including one side of its surrounding whitespace.
dd
The dd command deletes the entire current line, regardless of where the cursor is positioned on that line.
dit
The dit command deletes the text inside the nearest enclosing HTML or XML tag pair without removing the tags themselves.
D
The D command deletes everything from the cursor position to the end of the current line.
de
The de command deletes from the cursor position to the end of the current word.