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 the intended number is clear and protect neighbouring text.
A count before a motion or edit repeats it: 2w, 3x or 2dd. d2w and 2dw both delete two word motions. Count only the intended region. A semantic boundary such as a word or line end is safer when the length is uncertain. One counted edit is one undo step.
Example
If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command deliberately leaves one behind. Inspect the region before choosing a count.
Use Reset to try again.