Support comma line continuations

This commit is contained in:
Tim Pope
2010-05-10 22:46:53 -04:00
parent d29da9581f
commit 567c6d8f47
2 changed files with 7 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=
" Only define the function once. " Only define the function once.
if exists("*GetHamlIndent") if exists("*GetHamlIndent")
finish " finish
endif endif
let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)' let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
@@ -51,9 +51,11 @@ function! GetHamlIndent()
return indent return indent
elseif line =~ '^/\%(\[[^]]*\]\)\=$' elseif line =~ '^/\%(\[[^]]*\]\)\=$'
return increase return increase
elseif line =~ '^:' elseif group == 'hamlFilter'
return increase return increase
elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)' elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
return increase
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
return increase return increase
elseif line == '-#' elseif line == '-#'
return increase return increase

View File

@@ -41,8 +41,8 @@ syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
syn region hamlDocType start="^\s*!!!" end="$" syn region hamlDocType start="^\s*!!!" end="$"
syn region hamlRuby matchgroup=hamlRubyOutputChar 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="-" end="$" contained contains=@hamlRubyTop keepend syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
syn match hamlPlainChar "\\" contained 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,@hamlHtmlTop
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape