delete text inside HTML or XML tag

Tags: vim

Your text file may contain HTML or XML like this.

<p>Hello World</p>

Then, you want to delete or change text inside tag which is p tag for this example.

To delete text inside tag, in Vim normal mode, move a cursor to be inside tag and type this command.


This command refers to "delete inside tag".

To change the text, just change "d" to "c".


"change inside tag"

You can apply this to any command just relace d. For example

  • yit yank inside tag
  • vit visual mode inside tag