How do I access text from small deletes like dw or x?
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
18 results for "dw"
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
qa0dwjq
Record a macro that goes to the start of line with 0, deletes the first word with dw, and moves down with j.
:%normal command
The :normal command executes normal mode commands programmatically on a range of lines.
cw vs ciw
The cw and ciw commands both change a word, but they behave differently depending on cursor position.
editing #editing #text-objects #motions #normal-mode #productivity
:nnoremap <leader>x :norm! @a<CR>
Once you've perfected a macro by recording and testing it, you can make it permanent by converting it into a mapping in your vimrc.
p
The p command pastes (puts) the contents of the default register after the cursor.
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
de
The de command deletes from the cursor position to the end of the current word.
qa0f:dwj0q
How it works When recording a macro that you plan to repeat across multiple lines, the key technique is to end the macro positioned on the next line, ready for
w
The w command moves the cursor forward to the beginning of the next word.
"-
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
W, B, and E
How it works Vim distinguishes between two types of word objects: A word (lowercase w, b, e) is a sequence of letters, digits, and underscores, or a sequence of
:help registers
Vim has 10 types of registers, each serving a specific purpose.
:registers
The :registers command displays the contents of all Vim registers, showing you exactly what text is stored in each one.
"add
How it works When you delete text in Vim with commands like dd, dw, or x, the deleted text goes into the unnamed register and the numbered registers (1-9).
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
10@a
The 10@a command replays the macro recorded in register a exactly 10 times.
"1p then u.u.u.
Vim stores your last 9 deletions (of one line or more) in the numbered registers "1 through "9.
registers #registers #editing #normal-mode #undo-redo #paste