From 8c347a6f4591e75a16cca9350cffde5cfaefd25a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 11 May 2019 15:11:23 +0200 Subject: [PATCH] Use only one level of indentation after opening paren (#127) Fixes https://github.com/Vimjas/vim-python-pep8-indent/issues/126. --- indent/python.vim | 2 +- spec/indent/cython_spec.rb | 4 ++-- spec/indent/indent_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/indent/python.vim b/indent/python.vim index 36ff12a..532bab5 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -214,7 +214,7 @@ function! s:indent_like_opening_paren(lnum) if starts_with_closing_paren && !hang_closing let res = base else - let res = base + s:sw() + return base + s:sw() endif else " Indent to match position of opening paren. diff --git a/spec/indent/cython_spec.rb b/spec/indent/cython_spec.rb index 933801d..03dcbb2 100644 --- a/spec/indent/cython_spec.rb +++ b/spec/indent/cython_spec.rb @@ -23,14 +23,14 @@ describe "vim for cython" do describe "when using a cdef function definition" do it "indents shiftwidth spaces" do vim.feedkeys 'icdef long_function_name(\arg' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end describe "when using a cpdef function definition" do it "indents shiftwidth spaces" do vim.feedkeys 'icpdef long_function_name(\arg' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end end diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index db66b8f..641ad7e 100644 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@ -205,14 +205,14 @@ shared_examples_for "vim" do describe "when using a function definition" do it "indents shiftwidth spaces" do vim.feedkeys 'idef long_function_name(\arg' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end describe "when using a class definition" do it "indents shiftwidth spaces" do vim.feedkeys 'iclass Foo(\' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end @@ -430,7 +430,7 @@ shared_examples_for "vim" do it "ignores the call signature after a function" do vim.feedkeys 'idef f( JEDI_CALL_SIGNATURE\' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end end -- 2.39.2