Added option for folding of usepackage (#477)
This commit is contained in:
parent
3dc482db10
commit
3ec4b49656
@ -26,6 +26,7 @@ function! vimtex#fold#init_options() " {{{1
|
|||||||
\ 'subsection',
|
\ 'subsection',
|
||||||
\ 'subsubsection',
|
\ 'subsubsection',
|
||||||
\ ])
|
\ ])
|
||||||
|
call vimtex#util#set_default('g:vimtex_fold_usepackage', 1)
|
||||||
|
|
||||||
" Disable manual mode in vimdiff
|
" Disable manual mode in vimdiff
|
||||||
let g:vimtex_fold_manual = &diff ? 0 : g:vimtex_fold_manual
|
let g:vimtex_fold_manual = &diff ? 0 : g:vimtex_fold_manual
|
||||||
@ -140,6 +141,7 @@ function! vimtex#fold#level(lnum) " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Fold usepackages
|
" Fold usepackages
|
||||||
|
if g:vimtex_fold_usepackage
|
||||||
if line =~# '^\s*\\usepackage\s*\[\s*\%($\|%\)'
|
if line =~# '^\s*\\usepackage\s*\[\s*\%($\|%\)'
|
||||||
let s:usepackage = 1
|
let s:usepackage = 1
|
||||||
return 'a1'
|
return 'a1'
|
||||||
@ -147,6 +149,7 @@ function! vimtex#fold#level(lnum) " {{{1
|
|||||||
let s:usepackage = 0
|
let s:usepackage = 0
|
||||||
return 's1'
|
return 's1'
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" Fold chapters and sections
|
" Fold chapters and sections
|
||||||
for [part, level] in b:vimtex_fold.parts
|
for [part, level] in b:vimtex_fold.parts
|
||||||
|
@ -467,6 +467,18 @@ Options~
|
|||||||
\ "subsubsection",
|
\ "subsubsection",
|
||||||
\ ]
|
\ ]
|
||||||
<
|
<
|
||||||
|
*g:vimtex_fold_usepackage*
|
||||||
|
Use this option to disable/enable folding of long `\usepackage` lines. The
|
||||||
|
lines must be formatted like this for folding to work properly: >
|
||||||
|
|
||||||
|
\usepackage[
|
||||||
|
option 1,
|
||||||
|
...,
|
||||||
|
option n
|
||||||
|
]{name}
|
||||||
|
<
|
||||||
|
Default value: 1
|
||||||
|
|
||||||
*g:vimtex_imaps_enabled*
|
*g:vimtex_imaps_enabled*
|
||||||
Use this option to disable/enable the insert mode mappings.
|
Use this option to disable/enable the insert mode mappings.
|
||||||
|
|
||||||
@ -1584,6 +1596,7 @@ Associated settings:
|
|||||||
|g:vimtex_fold_parts|
|
|g:vimtex_fold_parts|
|
||||||
|g:vimtex_fold_sections|
|
|g:vimtex_fold_sections|
|
||||||
|g:vimtex_fold_envs|
|
|g:vimtex_fold_envs|
|
||||||
|
|g:vimtex_fold_usepackage|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INDENTATION *vimtex-indent*
|
INDENTATION *vimtex-indent*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user