1 "AUTHOR: Greg Sexton <gregsexton@gmail.com>
2 "WEBSITE: http://www.gregsexton.org/portfolio/gitv/
3 "LICENSE: Same terms as Vim itself (see :help license).
4 "NOTES: Much of the credit for gitv goes to Tim Pope and the fugitive plugin
5 " where this plugin either uses functionality directly or was inspired heavily.
7 "enabling these next lines breaks settings when reloading the buffer
8 "if exists("b:did_ftplugin") | finish | endif
9 "let b:did_ftplugin = 1
16 fu! Foldlevelforbranch() "{{{
17 let line = getline(v:lnum)
19 if line == "-- Load More --"
22 if line =~ "^-- \\[.*\\] --$"
26 let line = substitute(line, "\\s", "", "g")
27 let level = match(line, "*") + 1
28 return level == 0 ? -1 : level
30 setlocal foldexpr=Foldlevelforbranch()
32 fu! BranchFoldText() "{{{
33 "get first non-blank line
35 while getline(fs) =~ '^\s*$' | let fs = nextnonblank(fs + 1)
38 let line = getline(v:foldstart)
40 let line = getline(fs)
44 setlocal foldtext=BranchFoldText()