gabrielelana / vim-markdown

Markdown for Vim: a complete environment to create Markdown files with a syntax highlight that doesn't suck!
MIT License
740 stars 59 forks source link

Odd behavior with wrap #70

Open srsudar opened 6 years ago

srsudar commented 6 years ago

My automatic wrapping at 80 characters disappears when enabling the plugin. It looks like in markdown.vim you setlocal textwidth=0, which I think is to blame.

To counteract this I have autocmd Filetype markdown setlocal textwidth=80 in my .vimrc. However, this has exposed an odd issue with wrapping.

When a previous line starts with a single alphanumeric character, the second line is indented by two spaces.

Before gwap (which wraps in a paragraph):

screen shot 2018-07-30 at 8 01 15 pm

After gwap:

screen shot 2018-07-30 at 8 01 24 pm

This, with ! as the first character, wraps as I would expect:

screen shot 2018-07-30 at 8 03 04 pm

I would expect indentation to only apply if the list began with 1. with a period. Is the behavior I'm seeing technically correct, or is it a bug?

alexandreroberts commented 2 years ago

I have noticed the same problem (with the most up-to-date version of vim-markdown and neovim). I think the problem happens when the first word of the paragraph is a single character.

alexandreroberts commented 2 years ago

Now I tested it a bit more (not at all comprehensively) with A, I, 1, and !. The hanging indent occurs (when I do gwap on the paragraph) with A, I, and 1 but not with ! (nor with a multi-letter word):

Screen Shot 2022-08-16 at 12 15 36 PM Screen Shot 2022-08-16 at 12 16 05 PM Screen Shot 2022-08-16 at 12 16 29 PM Screen Shot 2022-08-16 at 12 16 18 PM Screen Shot 2022-08-16 at 12 15 52 PM

This makes me think that the problem is that somehow vim-markdown (or nvim itself?) reads the paragraph as an item of an enumerated list when it's not supposed to, as if there were a . after A, I, and 1.

alexandreroberts commented 2 years ago

P.S. I see now that #71 is supposed to take care of this, but the problem persists.