From cade17d13ee6e592df023ab47c24f18fe44fa7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Wed, 14 Dec 2016 21:09:38 +0100 Subject: [PATCH] Fixed #604: Remove indent condition for multi command folding --- autoload/vimtex/fold.vim | 10 ++++------ doc/vimtex.txt | 5 +---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/autoload/vimtex/fold.vim b/autoload/vimtex/fold.vim index 156f714..7f24733 100644 --- a/autoload/vimtex/fold.vim +++ b/autoload/vimtex/fold.vim @@ -443,20 +443,18 @@ function! s:cmd_multi(cmds) " {{{1 let l:fold = {} let l:fold.re = { - \ 'start' : l:re, + \ 'start' : l:re . '.*(\{|\[)\s*(\%.*)?$', \ 'end' : '^\s*}\s*$', \ 'text' : l:re . '\{[^}]*\}' \} function! l:fold.level(line, lnum) dict if a:line =~# self.re.start - \ && indent(a:lnum+1) > indent(a:lnum) - let self.indent = indent(a:lnum) + let self.opened = 1 return 'a1' - elseif has_key(self, 'indent') + elseif has_key(self, 'opened') \ && a:line =~# self.re.end - \ && indent(a:lnum) == self.indent - unlet self.indent + unlet self.opened return 's1' endif return '' diff --git a/doc/vimtex.txt b/doc/vimtex.txt index 2dece67..2cb0f1b 100644 --- a/doc/vimtex.txt +++ b/doc/vimtex.txt @@ -498,10 +498,7 @@ Options~ `single_opt` Useful for commands that open with a single long optional argument, then a short "real" argument. `multi` Useful for commands that start with a short regular argument - and continue with long optional and/or regular arguments. In - order for the folding to work as expected, this style depends - on the indentation to be correct. See the example below for - how to properly format the folded regions. + and continue with long optional and/or regular arguments. The option combines the contents of |g:vimtex_fold_commands| and |g:vimtex_fold_commands_default|. Entries in the former will have higher