| Tip 1 | Meet the Dot Command |
The dot command lets us repeat the last change. It is the most powerful and versatile command in Vim.
Vim’s documentation simply states that the dot command “repeats the last change” (see .ⓘ). It doesn’t sound like much, but in that simple definition we’ll find the kernel of what makes Vim’s modal editing model so effective. First we have to ask, “What is a change?”
To understand the power of the dot command, we have to realize that the “last change” could be one of many things. A change could act at the level of individual characters, entire lines, or even the whole file.
To demonstrate, we’ll use this snippet of text:
| | Line one |
| | Line two |
| | Line three |
| | Line four |
The x command deletes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access