X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b0d020f899c720469eaea8bfe50e71285ad053e6..d9efc9643da118f0928f204d2c5d3ce0e987eb44:/indent/python.vim?ds=sidebyside diff --git a/indent/python.vim b/indent/python.vim index 8444a22..8fb5a9b 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -61,7 +61,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' " jedi* refers to syntax definitions from jedi-vim for call signatures, which " are inserted temporarily into the buffer. let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "\\vstring|comment|jedi\\S"' + \ '=~? "\\vstring|comment|pythonbytes|jedi\\S"' let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' . \ '=~? "\\vcomment|jedi\\S"' @@ -138,27 +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 - " Remove any handled type, e.g. 'if'. - call remove(types, index(types, type)) + 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