@r to replace the "/li" at the start of a list with "ul" on the first line of the list and thus start an unordered list. (From a previous post you will know that the dash (-) bulleted lists now have "</li><li>" instead of the dash.)
:s+/li+ul+^MjThis is a simple substitution and I used "+" to delimit it as the usual "/" is used in the "from" string. It means:
:s+/li+ul+ - on this line substitute "ul" for "/li"
^Mj - <Enter> and move the cursor down a line
@e To end the unordered list, on the line after the last list item:
O</li></ul>^[jO</li></ul> - open a line above the cursor, change to Insert mode and insert "</li></ul>"
^[j - <Escape> to Normal mode and move the cursor down a line, to where it was.
@b - for a one-line unordered list
@r@eSimply a combination of the two previously shown macros.
The two macros, "@r" and "@e", were all I needed to finish marking up lists that had the list-items marked. But there are still lists without any markup, many of them the big Section indexes. For these unmarked lists I used "@e" from above and:
@u start an unordered list, called on the first item of the list:
I<ul><li>^[jI<ul><li> - Open insert mode at the beginning of the line and insert the markup that starts an unordered list and the first list item
^[j - Escape back to normal mode and move down a line
@l To put "</li><li>" at the beginning of lines:
I</li><li>^[jI can repeat this for all the remaining list item lines by typing, for instance "10@l" for a list with ten more list items.
@o - unordered list with a single list item. (start on line)
@u@eThis simply calls two previously mentioned macros, one starts the list the other ends it.
@d - for a two-list item unordered list (which I seem to have lots of):
@u@l@eIn the same vein as "@o" and "@b", above, this macro calls three previous macros
@c to markup comma separated lists. I'm dealing with a lot of these in Techniques.
f,2xi^M</li><li>^[This finds the next comma, deletes it and the following space, start Insert mode and <Enter> to move the remainder of the line down one line and mark it up as a list item, then escape back to Normal mode
I have a question out of this, maybe you can answer. Is there any way of simply pushing the remainder of a line down onto a new line the way that <Enter> does in Insert mode?
And finally today, before I get back to work.
@m - To delete a number and fullstop (or dash and space), and put in regular list-item markup:
This moves the cursor to the first character of the line, deletes 2 characters and calls @l, the list-item macro.