X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/26cfc8ef05385a8b5f526c4d461d982a82b119b2..ff4fc395a7787957f8b940f4fd7189d910d4169e:/after/ftplugin/mkd.vim?ds=sidebyside diff --git a/after/ftplugin/mkd.vim b/after/ftplugin/mkd.vim index b0b0946..26ccb23 100644 --- a/after/ftplugin/mkd.vim +++ b/after/ftplugin/mkd.vim @@ -35,14 +35,22 @@ func! Foldexpr_markdown(lnum) endif endfunc -setlocal foldexpr=Foldexpr_markdown(v:lnum) -setlocal foldmethod=expr - -"---------- everything after this is optional ----------------------- -" change the following fold options to your liking -" see ':help fold-options' for more -setlocal foldenable -setlocal foldlevel=0 -setlocal foldcolumn=0 -set foldmethod=expr -set foldopen-=search + +if !exists("g:vim_markdown_folding_disabled") + setlocal foldexpr=Foldexpr_markdown(v:lnum) + setlocal foldmethod=expr + + " allow the initial foldlevel to be configured in .vimrc + if !exists("g:vim_markdown_initial_foldlevel") + let g:vim_markdown_initial_foldlevel=0 + endif + let &l:foldlevel=g:vim_markdown_initial_foldlevel + + "---------- everything after this is optional ----------------------- + " change the following fold options to your liking + " see ':help fold-options' for more + setlocal foldenable + setlocal foldcolumn=0 + set foldmethod=expr + set foldopen-=search +endif