Deleting text

There are several commands that delete text from the screen. All of these begin with the letter d. After the d comes a letter indicating what you want to delete. Usually this letter is based on one of the cursor movement commands. For example:
Command
Action
d$
Deletes text from the cursor's current position to the end of the line.
dd
Deletes the entire line containing the cursor.
dL
Deletes text from the cursor's current position to the bottom of the screen.
dw
Deletes text from the cursor's current position to the beginning of the next word.
de
Deletes text from the cursor's current position to the end of a word. If the cursor is in the middle of a word, de deletes to the end of the same word; if the cursor is at the end of a word, de deletes to the end of the next word.

In the same way, d followed by → or ← (l or h) can delete a single character. Try both instructions and see which character gets deleted.

If you delete something by accident, you can undo the deletion by typing u (lowercase). Try this now. Type dH. What happens? Now type u and see the deleted text return.

A number followed by a delete command repeats the command that number of times. For example:
  • 5dw deletes five words
  • 10dd deletes ten lines