Given a common html bit like
<div>
<p>
Mary had a <b>little</b> lamb.
</p>
</div>
I want to cut the entire (not the inner only) div
for pasting elsewhere. I know there are alternative ways to do this like cutting a range of lines etc., but as a newish user of VIM I sorely need to move around tags in my frontend workflow and I just haven't seen a great way to do this yet.
press d ("d") to delete it.
You can copy a block of text by pressing Ctrl-v (or Ctrl-q if you use Ctrl-v for paste), then moving the cursor to select, and pressing y to yank. Now you can move elsewhere and press p to paste the text after the cursor (or P to paste before).
if you yank with "+y , you actually yank to and subsequently paste from what's called the "clipboard". In that case you will clobber whatever was in the clipboard up to that instant. To paste outside vi/vim, just use the usual CTRL + v `.
With your cusor on the outer div tag: dat
d elete a round t ag
Then paste it with p where you need it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With