From: Johann Klähn Date: Sun, 10 Nov 2013 08:03:50 +0000 (+0100) Subject: fix regression for multiple parens of different types X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/e2267fe1da0d3d9581e8d77a2cd6795a7cec02f4?ds=inline fix regression for multiple parens of different types --- diff --git a/indent/python.vim b/indent/python.vim index 3b64cf4..6fb1889 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -80,7 +80,7 @@ function! s:find_opening_paren(...) call filter(positions, 'v:val[0]') call sort(positions, 's:pair_sort') - return get(positions, 0, [0, 0]) + return get(positions, -1, [0, 0]) endfunction " Find the start of a multi-line statement diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index df402e8..4652ef9 100644 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@ -67,6 +67,18 @@ shared_examples_for "vim" do end end + describe "when after multiple parens of different types" do + it "indents by one level" do + vim.feedkeys 'if({\' + indent.should == shiftwidth + end + + it "lines up with the last paren" do + vim.feedkeys 'ifff({123: 456,\' + indent.should == 5 + end + end + describe "when '#' is contained in a string that is followed by a colon" do it "indents by one level" do vim.feedkeys 'iif "some#thing" == "test":#test\pass'