1

I have been using emmet for vim for some time now. Quite useful.

I have used .class1>b>em to expand quite often.

I have the following code:

<li><b>Point 1</b></li>

I just want to remove <li> and </li>. I tried Control Y - k by placing the cursor at all points in the line in normal mode. I am able to either delete the line or delete everything except <li></li>.

How do I get the expected behavior?

2

Lets define a new shortcut for it (\q -- please choose a better one)

:map \q "aditcat<C-x><C-r>a<ESC>

Explanation (first position in the tag to be removed):

  • "adit delete inside the current tag and save it in register a
  • cat change arround the current tag (including the tag) by
  • <C-x><C-r>a<ESC> the contents of register a

After testing, insert it in your .vimrc or similar.

| improve this answer | |
2

So, you need to delete surrounding tag.

dst

In your code: <li><b>Point 1</b></li> type dst when your cursor is over li tag will give you desired result. It is very handy, because you can also remove b tag when your cursor is on the text as this deletes the closest surrounding tag.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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