- commit
- 4a6560fc459c07afa6f0c10bc387536e5a0cde0c
- parent
- e8885d5e20f3c16bf5d46651687c1ab9587a4b7a
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2013-12-01 01:40
gerealize it
Diffstat
| M | after/plugin/folding.vim | 15 | +++++++-------- |
1 files changed, 7 insertions, 8 deletions
diff --git a/after/plugin/folding.vim b/after/plugin/folding.vim
@@ -1,5 +1,3 @@1 -1 set foldlevel=992 -13 1 function! IndentLevel(lnum) 4 2 return indent(a:lnum) / &tabstop 5 3 endfunction @@ -20,13 +18,13 @@ function! NextNonBlankLine(lnum) 20 18 endfunction 21 19 22 20 " fold by indent, but include first line23 -1 function! Fold(lnum)-1 21 function! IndentFold(lnum, offset) 24 22 if getline(a:lnum) =~? '\v^\s*$' 25 23 return '-1' 26 24 endif 27 2528 -1 let this_indent = IndentLevel(a:lnum)29 -1 let next_indent = IndentLevel(NextNonBlankLine(a:lnum))-1 26 let this_indent = IndentLevel(a:lnum) + a:offset -1 27 let next_indent = IndentLevel(NextNonBlankLine(a:lnum)) + a:offset 30 28 31 29 if next_indent <= this_indent 32 30 return this_indent @@ -36,7 +34,7 @@ function! Fold(lnum) 36 34 endfunction 37 35 38 36 " display first line with correct indentation39 -1 function! FoldText()-1 37 function! IndentFoldText() 40 38 let firstline = getline(v:foldstart) 41 39 if &expandtab 42 40 let space = '' @@ -46,6 +44,7 @@ function! FoldText() 46 44 return space . firstline 47 45 endfunction 48 46 -1 47 set foldlevel=99 49 48 set foldmethod=expr50 -1 set foldexpr=Fold(v:lnum)51 -1 set foldtext=FoldText()-1 49 set foldexpr=IndentFold(v:lnum,0) -1 50 set foldtext=IndentFoldText()