This snippet makes Vim automatically continue/end lists in insert mode, similar to the way word processors do:
- It automatically adds the bullet/number for the next list item when you press Return at the end of an existing item,
- When you press Return on an empty list item, it removes the bullet/number, ending the list.
It supports ordered lists with markers like 1.
and unordered lists with -
markers (because those are the markers I use.)
(It's particularly useful when using an iOS keyboard where punctuation and numerals are slow to access.)