From: Daniel Hahler Date: Thu, 7 May 2015 15:21:45 +0000 (+0200) Subject: Merge pull request #42 from blueyed/more-indent-function-def X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/0e3cb9a88e08a2760c1d92570409333f51cdb327?hp=446bfd0cb17b5ea5b13161440a61d1a5f057c703 Merge pull request #42 from blueyed/more-indent-function-def Add more indentation after function definition --- diff --git a/indent/python.vim b/indent/python.vim index 6912899..007c7e1 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -40,7 +40,7 @@ let s:block_rules = { \ '^\s*finally\>': ['try', 'except', 'else'] \ } let s:paren_pairs = ['()', '{}', '[]'] -let s:control_statement = '^\s*\(if\|while\|with\|for\|except\)\>' +let s:control_statement = '^\s*\(class\|def\|if\|while\|with\|for\|except\)\>' let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' " Skip strings and comments diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index 8ee78a6..cd37f1f 100644 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@ -198,6 +198,20 @@ shared_examples_for "vim" do end end + describe "when using a function definition" do + it "indents shiftwidth spaces" do + vim.feedkeys 'idef long_function_name(\arg' + indent.should == shiftwidth * 2 + end + end + + describe "when using a class definition" do + it "indents shiftwidth spaces" do + vim.feedkeys 'iclass Foo(\' + indent.should == shiftwidth * 2 + end + end + describe "when writing an 'else' block" do it "aligns to the preceeding 'for' block" do vim.feedkeys 'ifor x in "abc":\pass\else:'