so I am continuing my use off vim...I have this piece of html here:
<div id=container>
<ol>
<li><h1>banner</h1></li>
<li><first_item</li>
<li><second_item</li>
<li><third_item</li>
<li><fourth_item</li>
</div>
The div tag starts on the 17th line. I went to move the header one out of the list but still within the div tag. My moves were:
- 19gg (go to 19th line)
- dd (this is delete the line, but I see it the same as cutting the line as well)
- 17gg (go to the 17th line)
- p (pasting here brings the pasted line to the next line)
- shift + << (indent back one, because it used the original indentation which was one more due to being in the list)
Then there was the next question about removing the tags - there is most probably a plugin out there to help me which I will hunt down now.
Was what I did long winded? is there a quicker way or more efficient way to achieve this? (excluding the bit about removing the list tags around the header.
Tim Pope's unimpaired plugin, as well as my LineJuggler plugin provide
]e
mappings to quickly move line(s). With that, you can move a line from 19 to 17 (i.e. over 18) with1[e
.For removing surrounding tags, have a look at surround.vim - Delete/change/add parentheses/quotes/XML-tags , also from Tim. Alternatively, you could just delete the inner tag (
dat
), and use my UnconditionalPaste plugin'sglp
mapping to paste that as a separate line, or even useg[p
on line 18 to paste to above with the correct indent (of the current line).PS: Instead of
19gg
, you can also do19G
; still two key presses, but in parallel.