Markdown lists in Vim -
when creating list in markdown file, insert new item when pressing <cr>
. want apply both ordered , unordered lists. implies that, in ordered lists, list item number increment automatically. also, if press <cr>
on list item no content, remove item , add new line, ending list; current behaviour.
i managed achieve of functionality want this stackoverflow question autocommand:
autocmd filetype markdown setlocal com=s1:/*,mb:*,ex:*/,://,b:#,:%,:xcomm,n:>,b:- | set formatoptions=tcroqln
but autocommand doesn't work ordered lists , doesn't end list when <cr>
pressed on blank list item.
is possible add 2 features?
to handle ordered lists, treat them comments -
sigil, add :setlocal com+=b:1.
won't auto-increment, think markdown when rendering list, anyway.
there's no built-in logic ending list, can press <c-u>
remove automatically inserted comment. if that's not enough you, :imap <buffer> <cr> <cr>...
mapping can detect such situations (by function invoked in ...
part) , remove automatically.
Comments
Post a Comment