Count a known region
The technique
Count the lines first. With three obsolete lines, 2dd would leave one behind. One u undoes the whole counted delete.
Keys in this lesson
- 3x
- Delete three characters.
- 2dd
- Delete two lines.
- d2w
- Delete two words. 2dw does the same.
Before this lesson: Compose an edit.
More about this lesson
Use a count when you know exactly how many, and leave the text around it alone.
A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.
Example
If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.
Use Start over to try again.