Skip to content

Commit 6648287

Browse files
committed
Merge branch 'fix-def-indentation'
2 parents 18ca125 + 8577baf commit 6648287

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Foo
2+
class Bar
3+
f do
4+
g { def h; end }
5+
end
6+
7+
if foo
8+
bar ; end
9+
10+
if bar ; end
11+
12+
foo do
13+
foo = 3 . class
14+
foo = lambda { class One; end }
15+
foo = lambda { |args| class One; end }
16+
foo = bar; class One; end
17+
end
18+
end
19+
end

indent/ruby.vim

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ let s:ruby_deindent_keywords =
6363
" Regex that defines the start-match for the 'end' keyword.
6464
"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
6565
" TODO: the do here should be restricted somewhat (only at end of line)?
66-
let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
67-
\ '\|while\|until\|case\|unless\|begin\):\@!\>' .
68-
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
69-
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
66+
let s:end_start_regex =
67+
\ '\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
68+
\ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
7069
\ '\|\<do:\@!\>'
7170

7271
" Regex that defines the middle-match for the 'end' keyword.

0 commit comments

Comments
 (0)