123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
-
-
-
-
-
-
-
-
- func! Foldexpr_markdown(lnum)
- if (a:lnum == 1)
- let l0 = ''
- else
- let l0 = getline(a:lnum-1)
- endif
-
- let l1 = getline(a:lnum)
-
- let l2 = getline(a:lnum+1)
-
- if l2 =~ '^==\+\s*'
-
- return '>1'
- elseif l2 =~ '^--\+\s*'
-
- return '>2'
- elseif l1 =~ '^#'
-
- return '-1'
- elseif l0 =~ '^#'
-
- return '>'.matchend(l0, '^#\+')
- else
-
- return '='
- endif
- endfunc
-
-
- if !exists("g:vim_markdown_folding_disabled")
- setlocal foldexpr=Foldexpr_markdown(v:lnum)
- setlocal foldmethod=expr
-
-
-
-
- setlocal foldenable
- setlocal foldlevel=0
- setlocal foldcolumn=0
- set foldmethod=expr
- set foldopen-=search
- endif
|