Fixed #604: Remove indent condition for multi command folding
This commit is contained in:
parent
aa60cda284
commit
cade17d13e
@ -443,20 +443,18 @@ function! s:cmd_multi(cmds) " {{{1
|
|||||||
|
|
||||||
let l:fold = {}
|
let l:fold = {}
|
||||||
let l:fold.re = {
|
let l:fold.re = {
|
||||||
\ 'start' : l:re,
|
\ 'start' : l:re . '.*(\{|\[)\s*(\%.*)?$',
|
||||||
\ 'end' : '^\s*}\s*$',
|
\ 'end' : '^\s*}\s*$',
|
||||||
\ 'text' : l:re . '\{[^}]*\}'
|
\ 'text' : l:re . '\{[^}]*\}'
|
||||||
\}
|
\}
|
||||||
|
|
||||||
function! l:fold.level(line, lnum) dict
|
function! l:fold.level(line, lnum) dict
|
||||||
if a:line =~# self.re.start
|
if a:line =~# self.re.start
|
||||||
\ && indent(a:lnum+1) > indent(a:lnum)
|
let self.opened = 1
|
||||||
let self.indent = indent(a:lnum)
|
|
||||||
return 'a1'
|
return 'a1'
|
||||||
elseif has_key(self, 'indent')
|
elseif has_key(self, 'opened')
|
||||||
\ && a:line =~# self.re.end
|
\ && a:line =~# self.re.end
|
||||||
\ && indent(a:lnum) == self.indent
|
unlet self.opened
|
||||||
unlet self.indent
|
|
||||||
return 's1'
|
return 's1'
|
||||||
endif
|
endif
|
||||||
return ''
|
return ''
|
||||||
|
@ -498,10 +498,7 @@ Options~
|
|||||||
`single_opt` Useful for commands that open with a single long optional
|
`single_opt` Useful for commands that open with a single long optional
|
||||||
argument, then a short "real" argument.
|
argument, then a short "real" argument.
|
||||||
`multi` Useful for commands that start with a short regular argument
|
`multi` Useful for commands that start with a short regular argument
|
||||||
and continue with long optional and/or regular arguments. In
|
and continue with long optional and/or regular arguments.
|
||||||
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.
|
|
||||||
|
|
||||||
The option combines the contents of |g:vimtex_fold_commands| and
|
The option combines the contents of |g:vimtex_fold_commands| and
|
||||||
|g:vimtex_fold_commands_default|. Entries in the former will have higher
|
|g:vimtex_fold_commands_default|. Entries in the former will have higher
|
||||||
|
Loading…
Reference in New Issue
Block a user