How to get vim to format bulleted lists with indentation

In vim, I can set the text width parameter, and then the new text is formatted for wrapping. I can also use the gq command to explicitly wrap text. However, the behavior with bulleted lists is somewhat unexpected for me. Vim docs talk about using bullet hyphenated lists for bullets. When I try to do this, everything starts fine:

- This is a bulleted list item that has been wrapped. It looks good. 

However, if I continue the third line, it will indent:

 - This is a bulleted list item that has been wrapped over more than two lines. The indentation for lines after the second is unexpected. 

This happens with:

 formatoptions=tcq comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- 

Just to be clear, I would like to backtrack like this:

 - This is a bulleted list item that has been wrapped over more than two lines. I want every line after the first to get the same indent. 
+8
vim
source share
1 answer

After further research, it seems like I just needed to β€œset an auto-tenant” to get the expected behavior. This seems to work well for both wrapping text and typing and wrapping it with the gq command.

+6
source share

All Articles