4

I'm trying to delete self closing html tags, like the img tag below.

<div><img src='http://mypic.com/1.jpg' /></div> 

I've tried dit, dat, the tpope/vim-surround plugin, and other things with no luck. I've also tried having my cursor in different places.

1 Answer 1

5

Are you looking for da< or da>?

  • d deletes text (see :help d), and is followed by a motion movement (see :help motion.txt)
  • a< or a> selections the text that starts with < and that ends with > (see :help a<)

If you want to delete the opening tag, the closing tag, and its content, then you can type dat. If you just want to delete the contents of the tag, you can dit.

1
  • Thank's for the quick response. That's perfect. I should have thought of it! Jan 12, 2022 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.