Added option for folding of usepackage (#477)

This commit is contained in:
Karl Yngve Lervåg 2016-07-12 09:06:21 +02:00
parent 3dc482db10
commit 3ec4b49656
2 changed files with 22 additions and 6 deletions

View File

@ -26,6 +26,7 @@ function! vimtex#fold#init_options() " {{{1
\ 'subsection',
\ 'subsubsection',
\ ])
call vimtex#util#set_default('g:vimtex_fold_usepackage', 1)
" Disable manual mode in vimdiff
let g:vimtex_fold_manual = &diff ? 0 : g:vimtex_fold_manual
@ -140,6 +141,7 @@ function! vimtex#fold#level(lnum) " {{{1
endif
" Fold usepackages
if g:vimtex_fold_usepackage
if line =~# '^\s*\\usepackage\s*\[\s*\%($\|%\)'
let s:usepackage = 1
return 'a1'
@ -147,6 +149,7 @@ function! vimtex#fold#level(lnum) " {{{1
let s:usepackage = 0
return 's1'
endif
endif
" Fold chapters and sections
for [part, level] in b:vimtex_fold.parts

View File

@ -467,6 +467,18 @@ Options~
\ "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*
Use this option to disable/enable the insert mode mappings.
@ -1584,6 +1596,7 @@ Associated settings:
|g:vimtex_fold_parts|
|g:vimtex_fold_sections|
|g:vimtex_fold_envs|
|g:vimtex_fold_usepackage|
==============================================================================
INDENTATION *vimtex-indent*