vim-markdown icon indicating copy to clipboard operation
vim-markdown copied to clipboard

comments vs formatlistpat

Open memeplex opened this issue 6 years ago • 2 comments

This is more of a question than a report: I can't figure out the point of the following sequence:

setlocal comments=fb:*,fb:-,fb:+,n:>
...
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
...
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:

My confusion is due to:

  1. After setting comments, r and o are removed from formatoptions so the comment leader is not auto-inserted after pressing enter nor o.
  2. Other effects of setting comments seem to be subsumed by the formatlistpat settings in conjunction with the other formatoptions flags.

Could you clarify this? Thanks!

memeplex avatar Apr 29 '18 19:04 memeplex

From what I observed, the fact that [-*+] in 'formatlistpat' is missing space in front is causing 'formatoptions' n to not work on indented unordered lists such as nested lists.

Due to that, the fb:*,fb:-,fb:+ in 'comments' seems to have been added to serve as a workaround for the formatting issue with indented unordered lists.


To put it another way, modifying the lines as shown below seems to works fine and makes more sense to me.

setlocal comments=n:>
...
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:

i-give-up avatar Oct 29 '18 07:10 i-give-up

should it not be [-\\*+]?

Chaitanyabsprip avatar Aug 06 '23 11:08 Chaitanyabsprip