diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 46342a7..3c71860 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -144,20 +144,25 @@ for bullet in vimwiki#vars#get_syntaxlocal('bullet_types') " task list for point in vimwiki#vars#get_wikilocal('listsyms_list') \ + [vimwiki#vars#get_wikilocal('listsym_rejected')] - let comments .= ',b:' . bullet . ' [' . point . ']' + let comments .= ',fb:' . bullet . ' [' . point . ']' endfor " list - let comments .= ',b:' . bullet + let comments .= ',fb:' . bullet endfor let &l:comments = comments " Set format options (:h fo-table) " Disable autocomment because, vimwiki does it better -setlocal formatoptions-=c setlocal formatoptions-=r setlocal formatoptions-=o setlocal formatoptions-=2 +" Autowrap with leading comment +setlocal formatoptions+=c +" Do not wrap if line was already long +setlocal formatoptions+=l +" AutoWrap inteligent with lists setlocal formatoptions+=n +let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem') " Used to join 'commented' lines (blockquote, list) (see: #915) if v:version > 703 setlocal formatoptions+=j @@ -167,9 +172,6 @@ endif let &l:commentstring = vimwiki#vars#get_wikilocal('commentstring') -let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem') - - " ------------------------------------------------ " Folding stuff " ------------------------------------------------ diff --git a/test/list_return.vader b/test/list_return.vader index b9c8126..b738f8c 100644 --- a/test/list_return.vader +++ b/test/list_return.vader @@ -4,6 +4,50 @@ # better read this file with `set list` +Given vimwiki (List will hard wrap (Issue #991): + - one two three four five six seven + +Execute (Change textwith): + let textwidth = &textwidth + let linebreak = &linebreak + Log 'Textwidth, Linebreak was: ' . textwidth . ', ' . linebreak + set textwidth=40 + set linebreak + +Do (Insert more than tw and press return): + A indented line 1 + \ + indented line 2 + +Expect (Indentation after autowrap and ): + - one two three four five six seven + indented line 1 + indented line 2 + +Do (o new item): + A indented line 1 + \o + new item + +Expect (New item created): + - one two three four five six seven + indented line 1 + - new item + +Do (VimwikiReturn 3 5): + A indented line 1\ + :VimwikiReturn 3 5\ + new item + +Expect (New item created): + - one two three four five six seven + indented line 1 + - new item + +Execute (Restore textwith): + let &textwidth = textwidth + let &linebreak = linebreak + Given vimwiki (List with hard wraps): - Item 1 - Item 2