From: Daniel Hahler Date: Thu, 26 Jul 2018 07:56:26 +0000 (+0200) Subject: Simplify s:find_start_of_block X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/0cd83ebcc7c28719b695e72c9e26dd78479e67c4?ds=inline;hp=--cc Simplify s:find_start_of_block --- 0cd83ebcc7c28719b695e72c9e26dd78479e67c4 diff --git a/indent/python.vim b/indent/python.vim index f13ae9e..c56c2dc 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -138,25 +138,21 @@ endfunction " Find possible indent(s) of the block starter that matches the current line. function! s:find_start_of_block(lnum, types, multiple) let r = [] - let types = copy(a:types) let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>' let lnum = a:lnum let last_indent = indent(lnum) + 1 while lnum > 0 && last_indent > 0 let indent = indent(lnum) if indent < last_indent - for type in types - let re = '\v^\s*'.type.'>' - if getline(lnum) =~# re - if !a:multiple - return [indent] - endif - if index(r, indent) == -1 - let r += [indent] - endif + if getline(lnum) =~# re + if !a:multiple + return [indent] endif - endfor - let last_indent = indent(lnum) + if index(r, indent) == -1 + let r += [indent] + endif + let last_indent = indent + endif endif let lnum = prevnonblank(lnum - 1) endwhile