title: Markdown lists in Vim
body: <p>When creating a list in a markdown file, I would like to insert a new item when pressing <code>&lt;CR&gt;</code>. I
  want that to apply to both ordered and unordered lists. That implies that, in ordered lists, the
  list item number will increment automatically. Also, if I press <code>&lt;CR&gt;</code> on a list item with no
  content, I would like to remove the item and add a new line, essentially ending the list; This is
  the current behaviour.</p>
  
  <p>I managed to achieve some of the functionality that I want thanks to <a href="https://stackoverflow.com/questions/9065967/markdown-lists-in-vim-automatically-new-bullet-on-cr">this StackOverflow
  question</a>
  with this autocommand:</p>
  
  <pre><code>autocmd Filetype markdown setlocal com=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:&gt;,b:- | set formatoptions=tcroqln
  </code></pre>
  
  <p>But that autocommand doesn't work with ordered lists and doesn't end the list when <code>&lt;CR&gt;</code> is pressed
  on a blank list item.</p>
  
  <p>Is it possible to add those two features?</p>