Skip to content

Commit 0e3cb9a

Browse files
committed
Merge pull request #42 from blueyed/more-indent-function-def
Add more indentation after function definition
2 parents 446bfd0 + a946371 commit 0e3cb9a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

indent/python.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let s:block_rules = {
4040
\ '^\s*finally\>': ['try', 'except', 'else']
4141
\ }
4242
let s:paren_pairs = ['()', '{}', '[]']
43-
let s:control_statement = '^\s*\(if\|while\|with\|for\|except\)\>'
43+
let s:control_statement = '^\s*\(class\|def\|if\|while\|with\|for\|except\)\>'
4444
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
4545

4646
" Skip strings and comments

spec/indent/indent_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@
198198
end
199199
end
200200

201+
describe "when using a function definition" do
202+
it "indents shiftwidth spaces" do
203+
vim.feedkeys 'idef long_function_name(\<CR>arg'
204+
indent.should == shiftwidth * 2
205+
end
206+
end
207+
208+
describe "when using a class definition" do
209+
it "indents shiftwidth spaces" do
210+
vim.feedkeys 'iclass Foo(\<CR>'
211+
indent.should == shiftwidth * 2
212+
end
213+
end
214+
201215
describe "when writing an 'else' block" do
202216
it "aligns to the preceeding 'for' block" do
203217
vim.feedkeys 'ifor x in "abc":\<CR>pass\<CR>else:'

0 commit comments

Comments
 (0)