October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 9 | Compose Repeatable Changes |
Vim is optimized for repetition. In order to exploit this, we have to be mindful of how we compose our changes.
In Vim, we always have more than one way of doing something. In evaluating which way is best, the most obvious metric is efficiency: which technique requires the fewest keystrokes (a.k.a. VimGolf[3]). But how should we pick a winner in the event of a tie?
Suppose that our cursor is positioned on the “h” at the end of this line of text, and we want to delete the word “nigh.”
| | The end is nigh |
Since our cursor is already at the end of the word, we might begin by deleting backward.
| Keystrokes | Buffer Contents | ||
|---|---|---|---|
{start} |
| ||
db |
| ||
x |
|