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

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

setlocal foldmethod=expr
setlocal foldexpr=FreeFemFolds()
setlocal foldtext=FreeFemFoldText()