File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- " Fold routines for python code
1+ " Fold routines for python code, version 1.3
2+ " Last Change: 2009 Feb 1
23" I have been using the standard python-fold.vim for years,
34" and got more and more frustrated with it
4- " Author: Jurjen Bos (foldexpr), Max Ischenko (foldtext), Robert
5- " Ames (line counts)
5+ " Author: Jurjen Bos (foldexpr, and most of foldtext), Max Ischenko (foldtext)
66" Bug fix: Drexler Christopher, Tom Schumm, Geoff Gerrietts
77
8- " Version: 2.4
9- " Last Change: 2009 Jan 27
10-
118" Principles:
129" - a def/class starts a fold
1310" a line with indent less than the previous def/class ends a fold
@@ -39,16 +36,11 @@ function! PythonFoldText()
3936 let line = line . ' pass'
4037 endif
4138 let size = 1 + v: foldend - v: foldstart
42- if size < 10
43- let size = " " . size
44- endif
45- if size < 100
46- let size = " " . size
47- endif
48- if size < 1000
49- let size = " " . size
50- endif
51- return size . " lines: " . line
39+ let spcs = ' ................'
40+ while strlen (spcs) < winwidth (0 )
41+ let spcs = spcs . spcs
42+ endwhile
43+ return strpart (line .spcs, 0 , winwidth (0 )- strlen (size)-7 ).' .' .size.' lines'
5244endfunction
5345
5446
You can’t perform that action at this time.
0 commit comments