File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1- " Python-mode folding functions
1+ k " Python-mode folding function2
22" Notice that folding is based on single line so complex regular expressions
33" that take previous line into consideration are not fit for the job.
44
@@ -156,10 +156,14 @@ fun! s:BlockStart(line_number) "{{{
156156 " In case the end of the block is indented to a higher level than the def
157157 " statement plus one shiftwidth, we need to find the indent level at the
158158 " bottom of that if/for/try/while/etc. block.
159- let previous_definition = searchpos (s: def_regex , ' bcnW' )
159+ " Flags from searchpos() (same as search()):
160+ " b: search Backward instead of forward
161+ " n: do Not move the cursor
162+ " W: don't Wrap around the end of the file
163+ let previous_definition = searchpos (s: def_regex , ' bnW' )
160164 if previous_definition != [0 , 0 ]
161165 while previous_definition != [0 , 0 ] && indent (previous_definition[0 ]) >= indent (a: line_number )
162- let previous_definition = searchpos (s: def_regex , ' bncW ' )
166+ let previous_definition = searchpos (s: def_regex , ' bnW ' )
163167 call cursor (previous_definition[0 ] - 1 , 0 )
164168 endwhile
165169 endif
You can’t perform that action at this time.
0 commit comments