Delete text in between HTML tags in vim?
I know
di<
will delete in an HTML tag itself.
Is there an easy way to delete text in between two tags?
<span>How can I delete this text?</span>
Thanks!
dit
will delete the text between matching XML tags. (it
is for "inner tag block".)
See :h it
and :h tag-blocks
.
cit
ci"
Two of the best productivity enabler commands of vim.
I save a lot of time and effort with just those two.
try dt< while the cursor is on the first character to delete. In your example the 'H'.
dit - delete inner tag, remains in command mode
cit - change inner tag, changes to edit mode
di" - delete inside ""
di' - delete inside ''
di( - delete inside ()
di) - delete inside ()
di[ - delete inside []
di] - delete inside []
di{ -delete inside {}
di} - delete inside {}
di< - delete inside <>
di> - etc
swap first letter d
for c
, if you want to be in edit mode after typing the command