Grumblesaurus
Grumblesaurus

Reputation: 3119

Delete HTML Tag with VIM

I want to delete a single tag, like <strong>. I don't want to delete anything else, just that tag.

dat deletes <strong>content</strong>

dit deletes content.

df> works, but I have to have the cursor on <, otherwise it does not.

I want a quick set of key presses that deletes the entire tag without being quite so cursor-sensitive. Is that possible?

Upvotes: 2

Views: 464

Answers (2)

Vitor
Vitor

Reputation: 1976

Vim is able to match parenteses and such. So you should be able to use da< or da> to delete a tag.

Upvotes: 4

steffen
steffen

Reputation: 16948

dawdaw could do, but it's probably too long. You could bind it...

:map <F12> dawdaw

Also, it works only if you're inside the tag name.

Upvotes: 1

Related Questions