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

Unordered lists in Markdown don't respect hard line wraps #1364

Open
4 tasks done
jreichert opened this issue Aug 9, 2023 · 2 comments
Open
4 tasks done

Unordered lists in Markdown don't respect hard line wraps #1364

jreichert opened this issue Aug 9, 2023 · 2 comments
Assignees
Labels
lists Stuff about list syntax, list markers, etc.

Comments

@jreichert
Copy link

jreichert commented Aug 9, 2023

The behavior between ordered and unordered lists in Markdown when using hard line wraps at 80 characters is inconsistent (that is, using set textwidth=80). I believe the behavior for numbered lists is desired, and the behavior for unordered lists should be changed to match. The current behavior is as follows (the attached screenshot is the easiest way to understand the difference).

When using ordered lists:

  • List item shorter than 80 chars:
    • <CR> at the end of a line advances to the next line, inserting the next number in the list.
  • List item longer than 80 chars:
    • reaching 80 characters, the line wraps and is indented. The text on the next line is justified to start immediately under the text of the line above (i.e. indented two characters). This will repeat for any number of lines.
    • <S-CR> at the end of the list item advances to the next line, inserting the next number in the list.
    • <CR> advances to the next line, does not add a new number, and keeps the 2-character text justification. This repeats for any number of times you press <CR>.
    • If after pressing <CR> you enter some text and then press <S-CR>, it behaves exactly as described above.

When using unordered lists (regardless of '-', '*', or '+'):

  • List item shorter than 80 chars:
    • <CR> at the end of a line advances to the next line, inserting a new bullet of the same style as in the previous line.
  • List item longer than 80 chars:
    • reaching 80 characters, the line wraps but is not indented.
    • <CR> and <S-CR> both advance to the next line but do not insert a new bullet.
    • if you manually edit the second line that was created by wrapping to insert two spaces of indentation, then the previous behavior is restored. Each subsequent wrap for that bullet item will maintain the two-character indentation, and pressing <S-CR> behaves as it does in the case of ordered lists.

In effect, it seems that ordered lists remember that they are in list context when hard wrapping, but unordered lists do not.

Screenshot 2023-08-09 at 3 53 04 PM

Prior to submitting a new issue make sure to complete these steps:

  • Include the VimWiki settings from your .vimrc
let g:vimwiki_global_ext = 0
let g:vimwiki_list = [{'path': '~/Documents/vimwiki/',
            \ 'syntax': 'markdown', 'ext': '.md', 'auto_toc': 1, 'auto_tags': 1, 'automatic_nested_syntaxes': 1,
            \ 'custom_wiki2html': '/Users/jake/.asdf/installs/python/3.10.10/lib/python3.10/site-packages/vimwiki_markdown.py',
            \ 'template_path': '~/.EverVim/wiki/templates',
            \ 'template_default': 'def_template',
            \ 'links_space_char': '-',
            \ 'template_ext': '.html'}]
let g:vimwiki_markdown_link_ext=0
let g:vimwiki_valid_html_tags = 'b,i,s,u,sub,sup,kbd,br,hr, pre, script'
  • Include the syntax you are using (default / Markdown / MediaWiki): Markdown
  • Provide a detailed description of the problem including steps to reproduce the issue.
  • Include the output of :VimwikiShowVersion.
Os: Mac
Vim: 801
Branch: dev
Revision: 942da42
Date: 2023-06-22 19:33:54 -0400
@tinmarino tinmarino added the lists Stuff about list syntax, list markers, etc. label Mar 16, 2024
@tinmarino tinmarino self-assigned this Mar 16, 2024
@tinmarino
Copy link
Member

tinmarino commented Mar 16, 2024

I cannot reproduce, it is all good to me

Screenshot from 2024-03-16 15-30-38

verbose set formatlistpat
  formatlistpat=^\s*\%(\(\*\|-\|+\)\|\(\C\%(\d\+\.\)\)\)\s\+\%(\[\([ .oOX-]\)\]\s\)\?
        Last set from ~/.vim/plugged/vimwiki/ftplugin/vimwiki.vim line 169

verbose set autoindent?
  autoindent
        Last set from ~/.vim/plugged/vimwiki/ftplugin/vimwiki.vim line 134

verbose set formatoptions
  formatoptions=tqclnj
        Last set from ~/.vim/plugged/vimwiki/ftplugin/vimwiki.vim line 172 
```

@tinmarino
Copy link
Member

Please give the output of

verbose set formatlistpat
verbose set autoindent?
verbose set formatoptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lists Stuff about list syntax, list markers, etc.
Projects
None yet
Development

No branches or pull requests

2 participants