diff --git a/etc/examples/indent/strings.rb b/etc/examples/indent/strings.rb new file mode 100644 index 00000000..d69f806a --- /dev/null +++ b/etc/examples/indent/strings.rb @@ -0,0 +1,2 @@ +command = %|#{file}| +settings.log.info("Returning: #{command}") diff --git a/indent/ruby.vim b/indent/ruby.vim index e9953252..8bbbbbb0 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -34,7 +34,7 @@ set cpo&vim " Regex of syntax group names that are or delimit string or are comments. let s:syng_strcom = '\' " Regex of syntax group names that are strings. @@ -498,12 +498,15 @@ function GetRubyIndent(...) " If the previous line ended with [*+/.,-=], but wasn't a block ending, " indent one extra level. - if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\(}\|end\)') + if s:Match(lnum, s:non_bracket_continuation_regex) + \ && !s:Match(lnum, '^\s*\(}\|end\)') + \ && !s:IsInStringOrComment(lnum, len(line)) if lnum == p_lnum let ind = msl_ind + &sw else let ind = msl_ind endif + return ind endif " }}}2