Skip to content

Fix E127 #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions indent/python.vim
Original file line number Diff line number Diff line change
@@ -225,10 +225,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.
5 changes: 5 additions & 0 deletions spec/indent/indent_spec.rb
Original file line number Diff line number Diff line change
@@ -251,6 +251,11 @@
indent.should == 0
end

it "handles nested expressions (Flake8's E127)" do
vim.feedkeys 'i[\<CR>x for x in foo\<CR>if (\<CR>'
indent.should == shiftwidth * 2
end

it "still handles multiple parens correctly" do
vim.feedkeys 'iif (111 and (222 and 333\<CR>'
indent.should == 13