d is the delete operator. It takes a motion: dw deletes a word, d$ deletes to end of line. Doubling the operator (dd) makes it linewise. x and X are convenience deletes for single characters.
d is the delete operator. It's a verb that needs a noun. The noun is any motion โ and once you reach Text Objects, any text object as well. dw deletes a word. d$ deletes to end of line. dG deletes from the cursor to the end of the file. The grammar carries you here, and it keeps composing as you learn more nouns.
Delete character under cursor
Key
Note
x
Delete character before cursor
Key
Note
X
Delete a word
Key
Note
d
w
Delete to end of line
Key
Note
d
$
Delete to end of line (same as d$)
Key
Note
D
Delete the current line
Key
Note
d
d
x โ delete a characterX โ backspace-deletedw โ delete a wordD โ delete to end of linedd โ delete a line
Reference
Key
Action
x
Delete char under cursor
X
Delete char before cursor
d{motion}
Delete what {motion} covers
dd
Delete current line (linewise)
D
Delete to end of line (same as d$)
diw
Delete inner word (text object; see Text Objects)
dap
Delete around paragraph (text object; see Text Objects)
{n}dd
Delete {n} lines
Worked example โ x dw dd
Three deletes, three scopes.
Step 1 ยท Cursor on 'q'.
Step 2 ยท x ยท x โ one char gone.
Step 3 ยท dw ยท dw โ through next word boundary.
Step 4 ยท dd ยท dd โ entire line.
d is the operator; x is sugar for dl. The deleted text goes to the unnamed register and the numbered register 1.