diff --git a/indent/haml.vim b/indent/haml.vim index 5f547ad..b788085 100644 --- a/indent/haml.vim +++ b/indent/haml.vim @@ -16,7 +16,7 @@ setlocal indentkeys=o,O,*,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,= " Only define the function once. if exists("*GetHamlIndent") - finish + " finish endif let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)' @@ -51,9 +51,11 @@ function! GetHamlIndent() return indent elseif line =~ '^/\%(\[[^]]*\]\)\=$' return increase - elseif line =~ '^:' + elseif group == 'hamlFilter' return increase - elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)' + elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)' + return increase + elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$' return increase elseif line == '-#' return increase diff --git a/syntax/haml.vim b/syntax/haml.vim index a13c051..8fcd1bf 100644 --- a/syntax/haml.vim +++ b/syntax/haml.vim @@ -41,8 +41,8 @@ syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent syn region hamlDocType start="^\s*!!!" end="$" -syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" end="$" contained contains=@hamlRubyTop keepend -syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend +syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend +syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend syn match hamlPlainChar "\\" contained syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape