October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 23 | Prefer Operators to Visual Commands Where Possible |
Visual mode may be more intuitive than Vim’s Normal mode of operation, but it has a weakness: it doesn’t always play well with the dot command. We can route around this weakness by using Normal mode operators when appropriate.
Suppose that we want to transform the following list of links to make them shout:
| | <a href="#">one</a> |
| | <a href="#">two</a> |
| | <a href="#">three</a> |
We can select the inner contents of a tag by running vit, which can be read as: visually select inside the tag. The it command is a special kind of motion called a text object, which we’ll cover in detail in Tip 52.
In Visual mode, we make a selection and ...