Markdown support for Vim

I write a lot of Markdown in work, so it’s worth configuring vim to support it well.

  • Install https://github.com/plasticboy/vim-markdown to get syntax highlighting, folding, and more.
  • Add these lines to ~/.vimrc:

    " Recognise bulleted lists starting with ^\*, so that line wrapping doesn't
    " destroy bulleted lists.
    autocmd FileType markdown setlocal formatoptions+=n
      \ formatlistpat=^\\s*\\(\\*\\\|[0-9]\\.\\)\\s\\+
    " Automatically wrap text at textwidth.
    autocmd FileType markdown setlocal formatoptions+=t formatoptions-=l
    " Interpret blockquotes (lines starting with '>') as comments, so that line
    " wrapping doesn't mangle the blockquote markers.
    autocmd FileType markdown setlocal comments=n:>
    " Turn on spell checking.
    autocmd FileType markdown setlocal spell