Browse files

Merge branch 'fix-def-indentation'

  • Loading branch information...
2 parents 18ca125 + 8577baf commit 66482878d9675cfeac1285a9f9cc3d882959c18e @AndrewRadev AndrewRadev committed Apr 21, 2012
Showing with 22 additions and 4 deletions.
  1. +19 −0 etc/examples/indent/end_constructs.rb
  2. +3 −4 indent/ruby.vim
View
19 etc/examples/indent/end_constructs.rb
@@ -0,0 +1,19 @@
+module Foo
+ class Bar
+ f do
+ g { def h; end }
+ end
+
+ if foo
+ bar ; end
+
+ if bar ; end
+
+ foo do
+ foo = 3 . class
+ foo = lambda { class One; end }
+ foo = lambda { |args| class One; end }
+ foo = bar; class One; end
+ end
+ end
+end
View
7 indent/ruby.vim
@@ -63,10 +63,9 @@ let s:ruby_deindent_keywords =
" Regex that defines the start-match for the 'end' keyword.
"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
" TODO: the do here should be restricted somewhat (only at end of line)?
-let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
- \ '\|while\|until\|case\|unless\|begin\):\@!\>' .
- \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
- \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
+let s:end_start_regex =
+ \ '\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
+ \ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
\ '\|\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.

0 comments on commit 6648287

Please sign in to comment.