vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 817641e55149248db2763c360c581bcf187d5e42
parent d1b3fe34c9a9369c51424c04de6163b11e5c20f8
Author: Tinmarino <tinmarino@gmail.com>
Date:   Sun, 23 Aug 2020 01:59:12 -0400

Fix: Indentation broken within lists (Issue #991)

Side effect, formatoption+=c in order to also keep the joining behavior
with lists

Diffstat:
Mftplugin/vimwiki.vim | 14++++++++------
Mtest/list_return.vader | 44++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 6 deletions(-)

diff --git 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 @@ -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 + \<Cr> + indented line 2 + +Expect (Indentation after autowrap and <CR>): + - one two three four five six seven + indented line 1 + indented line 2 + +Do (o new item): + A indented line 1 + \<Esc>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\<Esc> + :VimwikiReturn 3 5\<Cr> + 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