File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 4
4
let s: blank_regex = ' ^\s*$'
5
5
let s: def_regex = ' ^\s*\%(class\|def\) \w\+'
6
6
let s: decorator_regex = ' ^\s*@'
7
+ let s: doc_begin_regex = ' ^\s*\%("""\|'''''' \)'
8
+ let s: doc_end_regex = ' \%("""\|'''''' \)\s*$'
9
+ let s: doc_line_regex = ' ^\s*\("""\|'''''' \).\+\1\s*$'
7
10
8
11
9
12
fun ! pymode#folding#text () " {{{
@@ -41,6 +44,17 @@ fun! pymode#folding#expr(lnum) "{{{
41
44
endif
42
45
endif
43
46
47
+ if line = ~ s: doc_begin_regex
48
+ \ && line !~ s: doc_line_regex
49
+ \ && prev_line = ~ s: def_regex
50
+ return " >" .(indent / &shiftwidth + 1 )
51
+ endif
52
+
53
+ if line = ~ s: doc_end_regex
54
+ \ && line !~ s: doc_line_regex
55
+ return " <" .(indent / &shiftwidth + 1 )
56
+ endif
57
+
44
58
if line = ~ s: blank_regex
45
59
if prev_line = ~ s: blank_regex
46
60
return -1
You can’t perform that action at this time.
0 commit comments