From: Daniel Hahler Date: Sat, 11 May 2019 13:11:23 +0000 (+0200) Subject: Use only one level of indentation after opening paren (#127) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/8c347a6f4591e75a16cca9350cffde5cfaefd25a?ds=sidebyside;hp=-c Use only one level of indentation after opening paren (#127) Fixes https://github.com/Vimjas/vim-python-pep8-indent/issues/126. --- 8c347a6f4591e75a16cca9350cffde5cfaefd25a 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