Fixed a problem with update of manual folds

For some reason, when I opened a file directly the manual fold method
was not refreshed correctly initially.

The present fix fixes the problem by refreshing the folds after first
CursorMoved event, which seems to work nicely.  Note that the autocommand
is deleted immediately.
This commit is contained in:
Karl Yngve Lervåg 2015-05-13 13:50:04 +02:00
parent 0ae44d8543
commit 9b5b013953

View File

@ -37,9 +37,6 @@ function! vimtex#fold#init(initialized) " {{{1
setl foldexpr=vimtex#fold#level(v:lnum)
setl foldtext=vimtex#fold#text()
" Initalize folds
call vimtex#fold#refresh('zX')
" Remap zx to refresh fold levels
nnoremap <silent><buffer> zx :call vimtex#fold#refresh('zx')<cr>
nnoremap <silent><buffer> zX :call vimtex#fold#refresh('zX')<cr>
@ -64,7 +61,11 @@ function! vimtex#fold#init(initialized) " {{{1
augroup END
endif
else
setl foldmethod=manual
augroup latex_fold
autocmd!
autocmd CursorMoved *.tex call vimtex#fold#refresh('zx')
autocmd CursorMoved *.tex autocmd! latex_fold
augroup END
endif
endfunction