October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 4 | Act, Repeat, Reverse |
When facing a repetitive task, we can achieve an optimal editing strategy by making both the motion and the change repeatable. Vim has a knack for this. It remembers our actions and keeps the most common ones within close reach so that we can easily replay them. In this tip, we’ll introduce each of the actions that Vim can repeat and learn how to reverse them.
| Intent | Act | Repeat | Reverse |
|---|---|---|---|
Make a change | {edit} | . | u |
Scan line for next character | f{char}/t{char} | ; | , |
Scan line for previous character | F{char}/T{char} | ; | , |
Scan document for next match | /pattern<CR> | n | N |
Scan document for previous match | ?pattern<CR> | n | N |
Perform substitution | :s/target/replacement | & | u |
Execute a sequence of changes | qx{changes}q ... |