X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/19c53ee5f8b6e9054d0ee1c295d876ccb96a21f7..6d5ce1e610b53560985aee3d20b720085fccffdc:/indent/python.vim?ds=inline diff --git a/indent/python.vim b/indent/python.vim index a095ca6..cd44fba 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -92,14 +92,6 @@ else endfunction endif -function! s:pair_sort(x, y) - if a:x[0] == a:y[0] - return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1 - else - return a:x[0] > a:y[0] ? 1 : -1 - endif -endfunction - " Find backwards the closest open parenthesis/bracket/brace. function! s:find_opening_paren(...) " optional arguments: line and column (defaults to 1) to search around @@ -225,10 +217,13 @@ function! s:indent_like_opening_paren(lnum) " indent further to distinguish the continuation line " from the next logical line. if text =~# b:control_statement && res == base + s:sw() - return base + s:sw() * 2 - else - return res + " But only if not inside parens itself (Flake's E127). + let [paren_lnum, _] = s:find_opening_paren(paren_lnum) + if paren_lnum <= 0 + return res + s:sw() + endif endif + return res endfunction " Match indent of first block of this type.