Skip to content

Instantly share code, notes, and snippets.

@nhooyr
Created February 25, 2016 00:46
Show Gist options
  • Save nhooyr/9f88af6db525d12d3fb0 to your computer and use it in GitHub Desktop.
Save nhooyr/9f88af6db525d12d3fb0 to your computer and use it in GitHub Desktop.
function! s:setFoldManual()
let w:last_fdm = &foldmethod
setlocal foldmethod=manual
endfunction
function! s:resFoldMethod()
let &l:foldmethod = w:last_fdm
silent! foldopen
endfunction
augroup fold
autocmd!
autocmd InsertEnter * call s:setFoldManual()
autocmd InsertLeave * call s:resFoldMethod()
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment