mirror of
https://github.com/tpope/vim-markdown.git
synced 2025-11-19 07:13:41 -05:00
Fold YAML front matter
This commit is contained in:
@@ -22,6 +22,11 @@ endif
|
|||||||
function! MarkdownFold()
|
function! MarkdownFold()
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
|
|
||||||
|
" Front matter
|
||||||
|
if v:lnum == 1 && line == '---'
|
||||||
|
return ">20"
|
||||||
|
endif
|
||||||
|
|
||||||
" Regular headers
|
" Regular headers
|
||||||
let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
|
let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
|
||||||
if depth > 0
|
if depth > 0
|
||||||
@@ -38,6 +43,12 @@ function! MarkdownFold()
|
|||||||
return ">2"
|
return ">2"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" End of front matter
|
||||||
|
let prevline = getline(v:lnum - 1)
|
||||||
|
if (prevline == '...') && (foldlevel(v:lnum-1) == 20)
|
||||||
|
return '>0'
|
||||||
|
endif
|
||||||
|
|
||||||
return "="
|
return "="
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user