diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index d0fc41a..812ff46 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -22,11 +22,6 @@ endif function! MarkdownFold() let line = getline(v:lnum) - " Front matter - if v:lnum == 1 && line == '---' - return ">20" - endif - " Regular headers let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=') if depth > 0 @@ -43,10 +38,16 @@ function! MarkdownFold() return ">2" endif + " Front matter + if v:lnum == 1 && line == '---' + let b:markdown_frontmatter = 1 + return ">1" + endif + " End of front matter - let prevline = getline(v:lnum - 1) - if (prevline == '...') && (foldlevel(v:lnum-1) == 20) - return '>0' + if (line == '...') && b:markdown_frontmatter + unlet b:markdown_frontmatter + return '<1' endif return "="