Skip to content

Commit 0cd83eb

Browse files
committed
Simplify s:find_start_of_block
1 parent 0c4a52f commit 0cd83eb

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

indent/python.vim

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,21 @@ endfunction
138138
" Find possible indent(s) of the block starter that matches the current line.
139139
function! s:find_start_of_block(lnum, types, multiple)
140140
let r = []
141-
let types = copy(a:types)
142141
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
143142
let lnum = a:lnum
144143
let last_indent = indent(lnum) + 1
145144
while lnum > 0 && last_indent > 0
146145
let indent = indent(lnum)
147146
if indent < last_indent
148-
for type in types
149-
let re = '\v^\s*'.type.'>'
150-
if getline(lnum) =~# re
151-
if !a:multiple
152-
return [indent]
153-
endif
154-
if index(r, indent) == -1
155-
let r += [indent]
156-
endif
147+
if getline(lnum) =~# re
148+
if !a:multiple
149+
return [indent]
157150
endif
158-
endfor
159-
let last_indent = indent(lnum)
151+
if index(r, indent) == -1
152+
let r += [indent]
153+
endif
154+
let last_indent = indent
155+
endif
160156
endif
161157
let lnum = prevnonblank(lnum - 1)
162158
endwhile

0 commit comments

Comments
 (0)