vim Vim Text Objects Select text inside a tag


Example

We can select a text within an html or xml tag by using visual selection v and text object it .

  1. Go to normal mode py pressing ESC
  2. Type vit from anywhere within the html or xml section
  3. This will visually select all text inside the tag

enter image description here

All other text objects can also be used to operate on the text inside the tag

  1. cit - delete text inside the tag and place in insert mode
  2. dit - delete text inside the tag and remain in normal mode
  3. cat - delete around tag and place in insert mode
  4. dat - delete text around the tag and remain in normal mode