How to surround multiple lines individually with surround.vim

  1. Select visually all the lines with <S-v>
  2. Type :norm yss<li> then <CR>

Result:

<li>Bananas</li>
<li>Citrus</li>
<li>Orange</li>

Ranges are good too: :.,+2norm yss<li><CR> does the same, as well as :1,3norm yss<li><CR>.


Use Visual Block and then surround.

<c-v> to start visual block mode and then move to the last line of the text. Use $ to select to the end of each line then S<li>

All together:

<c-v>2j$S<li>

The faster way I can think about it using zencoding-vim. With that plugin you can select visually the text, then you can type ctr+y , and then type:

ul > li*

Adn you'll get the list. It looks like magic and it's very fast too.