File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 15
15
16
16
fun ! pymode#folding#text () " {{{
17
17
let fs = v: foldstart
18
- while getline (fs ) = ~ ' \%(^\s*@\)\|\%(^\s*\%("""\| '''''' \)\s*$\) '
18
+ while getline (fs ) !~ s: def_regex && getline ( fs ) !~ s: doc_begin_regex
19
19
let fs = nextnonblank (fs + 1 )
20
20
endwhile
21
+ if getline (fs ) = ~ s: doc_begin_regex
22
+ let fs = nextnonblank (fs + 1 )
23
+ endif
21
24
let line = getline (fs )
22
25
23
26
let nucolwidth = &fdc + &number * &numberwidth
@@ -41,8 +44,24 @@ fun! pymode#folding#expr(lnum) "{{{
41
44
let indent = indent (a: lnum )
42
45
let prev_line = getline (a: lnum - 1 )
43
46
44
- if line = ~ s: def_regex || line = ~ s: decorator_regex
45
- if prev_line = ~ s: decorator_regex
47
+ if line = ~ s: decorator_regex
48
+ return " >" .(indent / &shiftwidth + 1 )
49
+ endif
50
+
51
+ if line = ~ s: def_regex
52
+ " Check if last decorator is before the last def
53
+ let decorated = 0
54
+ let lnum = a: lnum - 1
55
+ while lnum > 0
56
+ if getline (lnum) = ~ s: def_regex
57
+ break
58
+ elseif getline (lnum) = ~ s: decorator_regex
59
+ let decorated = 1
60
+ break
61
+ endif
62
+ let lnum -= 1
63
+ endwhile
64
+ if decorated
46
65
return ' ='
47
66
else
48
67
return " >" .(indent / &shiftwidth + 1 )
You can’t perform that action at this time.
0 commit comments