html

Vim Motions for HTML Tags

When working with HTML tags in Vim, it and at can be quite useful. it means “inner tag block”, while at means “a tag block”.

To change “Hello World” to “Goodbye”, we just need to position our anywhere in the <p> tag, and do cit then Goodbye:

<div>
  <p>Hello World</p>
   ^ (citGoodbye)
</div>
---
<div>
  <p>Goodbye</p>
</div>

To delete the entire <div> block, we can position our cursor on the <div> tag, and do dat:

<div>
^ (dat)
  <p>Goodbye</p>
</div>
---