Delete
d is the verb. Pair it with any motion.
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.
| Key | Note |
|---|---|
| x |
| Key | Note |
|---|---|
| X |
| Key | Note |
|---|---|
| d | |
| w |
| Key | Note |
|---|---|
| d | |
| $ |
| Key | Note |
|---|---|
| D |
| Key | Note |
|---|---|
| d | |
| d |
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.
[missing screenshot editing.delete/frame_01.color.svg โ run python content/render_screenshots.py]
[missing screenshot editing.delete/frame_02.color.svg โ run python content/render_screenshots.py]
[missing screenshot editing.delete/frame_03.color.svg โ run python content/render_screenshots.py]
[missing screenshot editing.delete/frame_04.color.svg โ run python content/render_screenshots.py]
d is the operator; x is sugar for dl. The deleted text goes to the unnamed register and the numbered register 1.
See also: The Universal Grammar, Change, Yank and Put, The Unnamed Register