From a28f5492204a657219e16c6e663cda8047883258 Mon Sep 17 00:00:00 2001 From: James Blanding Date: Thu, 2 May 2013 13:36:31 -0400 Subject: [PATCH 1/1] Add option to set initial foldlevel --- README.md | 10 ++++++++++ after/ftplugin/mkd.vim | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d7e587..4c9fcdf 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,16 @@ Add the following line to your `.vimrc` to disable folding. let g:vim_markdown_folding_disabled=1 ``` +**Set Initial Foldlevel** + +Add the following line to your `.vimrc` to set the initial foldlevel. This +option defaults to 0 (i.e. all folds are closed) and is ignored if folding +is disabled. + +```vim +let g:vim_markdown_initial_foldlevel=1 +``` + ## License The MIT License (MIT) diff --git a/after/ftplugin/mkd.vim b/after/ftplugin/mkd.vim index ed78895..26ccb23 100644 --- a/after/ftplugin/mkd.vim +++ b/after/ftplugin/mkd.vim @@ -40,11 +40,16 @@ 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 foldlevel=0 setlocal foldcolumn=0 set foldmethod=expr set foldopen-=search -- 2.39.5