vim-markdown
vim-markdown copied to clipboard
Long list items don't indent on wrap.
If I have a markdown list with items longer than two lines, lines past the second don't autowrap correctly. e.g.:
1. Lorem ipsum dolor sit amet
2. consectetur adipiscing elit, sed do eiusmod
3. tempor incididunt ut labore et dolore magna aliqua. Ut enim # OK
ad minim veniam, quis nostrud exercitation ullamco laboris # OK
nisi ut aliquip ex ea commodo consequat. Duis aute irure # Wrong, not indented
dolor in reprehenderit in. # Still wrong
4. voluptate velit esse cillum dolore.
5. ...and so on
I'm not entirely sure this is a bug rather than interference from something else in my vim config, but I couldn't find anything obvious to cause it.
I've been experiencing this for quite a while, but always just Vjjjj>>
and manually shove the lines over afterward. My .vimrc is pretty straightforward, so I'm pretty sure this behavior is from vim-markdown.
Any possible fix in the near future? This is quite frustrating, since I come across a lot of these, these days.
I am also experiencing this.
It's just 'formatoptions'
. The problem is that fixing one behavior tends to break another.
@tpope You are correct. I fixed it with se fo-=2 ai
just now.
The indentexpr
function used in indent/rst.vim
in upstream Vim seems to address this issue.
Skipping the " Indent :FIELD: lines.
portion of GetRSTIndent
that is unnecessary for Markdown, that function looks like it should work as-is for Markdown as well (except for the current footnote reference support).
This issue can be fixed with set autoindent
in a vimrc file.
Note that the list continuation behavior is provided by the n
option of formatoptions. If you check the formatoptions documentation with :h fo-table
, you'll see next to n
: "Note that 'autoindent' must be set too." My guess is that the n
option only does anything special when going from the first item of a list option to the second, and then relies on autoindent to keep the indentation level consistent past that.
It might be reasonable for this plugin to set autoindent
.