From 7152088e22fa18bc0da6cd3e70df2bd80fb867c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Mon, 7 Oct 2013 15:49:22 +0200 Subject: [PATCH] Fix fdm save and restore for insertmode --- autoload/latex/fold.vim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/autoload/latex/fold.vim b/autoload/latex/fold.vim index 4088c06..fa0e084 100644 --- a/autoload/latex/fold.vim +++ b/autoload/latex/fold.vim @@ -19,8 +19,8 @@ function! latex#fold#init(initialized) if !a:initialized augroup latex_fold autocmd! - autocmd InsertEnter *.tex setlocal foldmethod=manual - autocmd InsertLeave *.tex setlocal foldmethod=expr + autocmd InsertEnter *.tex call s:fdm_save() + autocmd InsertLeave *.tex call s:fdm_restore() augroup END endif endif @@ -163,6 +163,18 @@ function! latex#fold#text() endfunction " }}}1 +" {{{1 s:fdm_restore +function! s:fdm_restore() + silent execute 'setlocal foldmethod=' . s:fdm +endfunction + +" {{{1 s:fdm_save +let s:fdm='' +function! s:fdm_save() + let s:fdm = &foldmethod + setlocal foldmethod=manual +endfunction + " {{{1 s:find_fold_sections function! s:find_fold_sections() "