Trace Your Selection with Precision Text Objects
For brackets, quotation marks, and so on, such as the labels in Html,xml, are <a> </a>
paired, Vim can understand this structure, and select the text of their restricted area.
For the following JS code
Execute the following command
The first cursor on url
the R, and then enter the v
command, enter the visual mode, the i}
selection of {} content but does not contain {}, the a"
selection "" and contains "". it
represents content that contains the contents of a tag but does not contain a label in the above JS code <a>
</a>
.
In more detail, you can see
I start with no pattern symbol, and a begins with a symbol containing the pattern.
Performing Operations with Text Objects
Similar f
commands and /
commands can be combined with VIM's operator command, such as
d{motion} , c{motion} , and y{motion}
D means to delete the area,
c means changing the contents of the area, deleting the selection and then entering insert mode
Y indicates that the region is copied
Test as follows
ci"
Delete ""
the contained {url}
, and then replace the user input #
.
cit
Delete <a> </a>
the contained {title}
, and then replace the user input click here
.
[Practical.vim (2012.9)]. DREW.NEIL.TIP51 Study Summary