summaryrefslogtreecommitdiff
path: root/nvim/after/ftplugin/vim/folding.vim
blob: 1454cbeca4414b64251bbed2572e9e495a26553e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function! VimFolds()
    let thisline = getline(v:lnum)
    if match(thisline,'^"" ') >= 0
        return ">1"
    elseif match(thisline,'^" ') >=0
        return ">1"
    else
        return "="
    endif
endfunction

function! VimFoldText()
    let startline = getline(v:foldstart)
    if match(startline,'^"" ') >= 0
        let title = substitute(startline,'^"" \(.*\)$','\1',"")
        return '# ' . title
    elseif match(startline,'^" ') >=0
        let title = substitute(startline,'^" \(.*\)$','\1',"")
        return '    ## ' .title
    endif
endfunction

setlocal foldmethod=expr
setlocal foldexpr=VimFolds()
setlocal foldtext=VimFoldText()