Line formatting (gq) does not correctly indent long list items

2018-05-01 16:35:46

I want to wrap my text to 79 characters, I do that using the gq command. For most filetypes this works just fine and indents following lines.

With Markdown, however, it does the following:

The pattern seems to be that only the second line gets indented.

This is not really nice as it then parses differently. For reStructuredText (:set ft=rst) it works just fine with longer lines:

What would I have to do to get the same results in Markdown as in reStructuredText?

As far as I can tell (and from @Antony's comments), autoindent must be turned on for this to work. From the help pages:

When autoindent is on, formatting (with the "gq" command or when you reach 'textwidth' in Insert mode) uses the indentation of the first line.

…and, in practice, it works for me to reformat long list items.

  • As far as I can tell (and from @Antony's comments), autoindent must be turned on for this to work. From the help pages:

    When autoindent is on, formatting (with the "gq" command or when you reach 'textwidth' in Insert mode) uses the indentation of the first line.

    …and, in practice, it works for me to reformat long list items.

    2018-05-01 18:46:01