X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b0d020f899c720469eaea8bfe50e71285ad053e6..8d64e05e37bc3c9a01bd7c5d6e2948470551c351:/indent/python.vim diff --git a/indent/python.vim b/indent/python.vim index 8444a22..6f84637 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%(contents)=$|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 @@ -319,7 +313,7 @@ function! s:indent_like_previous_line(lnum) return -1 endif - if !empty && s:is_dedented_already(current, base) + if (current || !empty) && s:is_dedented_already(current, base) return -1 endif