Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long list items don't indent on wrap. #98

Open
andrew-vant opened this issue Apr 4, 2016 · 7 comments
Open

Long list items don't indent on wrap. #98

andrew-vant opened this issue Apr 4, 2016 · 7 comments

Comments

@andrew-vant
Copy link

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.

@jakewisse
Copy link

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.

@jerinphilip
Copy link

Any possible fix in the near future? This is quite frustrating, since I come across a lot of these, these days.

@jgrar
Copy link

jgrar commented Mar 19, 2018

I am also experiencing this.

@tpope
Copy link
Owner

tpope commented Mar 19, 2018

It's just 'formatoptions'. The problem is that fixing one behavior tends to break another.

@jgrar
Copy link

jgrar commented Mar 21, 2018

@tpope You are correct. I fixed it with se fo-=2 ai just now.

jgrar added a commit to jgrar/dotfiles that referenced this issue Mar 24, 2018
`formatoptions+=2` messes up automatic indents for list items,
removing it solves this.

See: tpope/vim-markdown#98 (comment)
@dandersson
Copy link

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).

@msuperdock
Copy link

msuperdock commented Jan 25, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants