2

Add this to your after/ftplugin/c.vim or after/ftplugin/cpp.vim: let &l:formatlistpat .= '\|^\s*-\s*' It tell vim to recognize - as numbered list. set them in vimrc is a mistake, this option is local to buffer. You can use :verbose setlocal formatlistpat to check if it's set properly. Result: // - foo foo foo foo foo foo foo foo foo foo foo foo foo ...


1

You can also get this behavior with this minimalist vimrc set nocompatible filetype on set textwidth=80 set formatoptions=c let g:tex_flavor="latex" au Filetype tex set comments=sO:%\ -,mO:%\ \ ,:% au Filetype cpp set comments=sO:\/\/\ -,mO:\/\/\ \ ,:\/\/ When editing tex files you would get the following % - foo foo foo foo foo foo foo foo foo foo ...


1

It would be really hard to do this for a real world markdown files with regards to all edge cases (tables, code blocks, list items, headers etc). But for example given you can try following :h :global commands: :g/^\S.*\n\S/normal! vipJ :g/^\S/normal! gww Join with :g/^\S.*\n\S/normal! vipJ It searches for all "paragraphs" -- 2 consecutive lines that ...


Only top voted, non community-wiki answers of a minimum length are eligible