I am using Vim with formatoptions +=a as described in Vim: word wrap for documents to format lines automatically while I write documents, expecially Markdown documents.

My problem is that Vim wants to reformat also bullet lists because there is blank line between each bullet point.

What happes is that vim reformats

This is wath we will do:

* task 1,
* task 2,
* task 3.


This is wath we will do:

* task 1,   task 2,   task 3.

(I also do not understand why the asterisks disappear in this reformatting process.)

How can I make Vim stop reformatting these lists?

  • The asterisks disappear because Vim mistaken them for comments leaders.
    – gioele
    Feb 9, 2012 at 15:59

2 Answers 2


Try this:

  • add n to formatoptions so vim recognizes lists (:set fo+=n)
  • set the formatlistpat option to recognize asterisk as bullets (set flp+=\\\|^\\*\\s*) (note that number of backslashes depends on your magicness level).

It's not perfect based on my testing but it seems to be close.


Is the filetype option set to markdown when you are editing your Markdown files? You can use :verbose set filetype? to inspect the current value.

When you have run :filetype plugin on (e.g. from your .vimrc), and filetype is set to markdown, Vim will source $VIMRUNTIME/ftplugin/markdown.vim which will set some options (comments, formatlistpat, and formatoptions) that should help with formatting Markdown list items.

Note: The common Markdown filename pattern *.md is actually mapped to the modula2 filetype by $VIMRUNTIME/filetype.vim. You may want to override this setting if you commonly use this filename pattern for your Markdown files. You could do that by putting this in your .vimrc file:

autocmd! filetypedetect BufNewFile,BufRead *.md setfiletype markdown

Alternatively, you could add a modeline to each file:

<!-- vim: set filetype=markdown : -->

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .