51 Commits

Author SHA1 Message Date
Tim Pope
fb83d43917 Allow Haml interpolation inside JavaScript strings 2010-08-02 16:44:54 -04:00
Tim Pope
55f14fd4fc Fix interpolation in Sass attribute 2010-07-28 10:05:12 -04:00
Tim Pope
9e25996111 Loosen @mixin for SCSS 2010-07-28 09:41:54 -04:00
Tim Pope
ca196e671b Loosen @extend and @include for SCSS 2010-07-28 09:37:05 -04:00
Tim Pope
627e3950f1 Show interpolation in properties and attributes 2010-07-28 09:14:43 -04:00
Tim Pope
c8de253905 Synchronize dates for delivering upstream 2010-07-26 18:40:36 -04:00
Tim Pope
dd0a6233d5 Allow interpolation in strings in Sass 2010-07-26 18:05:38 -04:00
Tim Pope
caf7f9cf29 Highlight @warn in Sass 2010-07-25 19:34:37 -04:00
Tim Pope
e448efdb86 Provide a 'define' that matches Sass mixins 2010-07-25 15:59:21 -04:00
Tim Pope
bd43cd97f0 Lower precedence of .css in 'suffixesadd' 2010-07-25 15:45:55 -04:00
Tim Pope
e87143f99e Don't choke on missing semicolon in "a {b:c}" 2010-07-25 15:34:29 -04:00
Tim Pope
54139ceb5b Properly highlight SCSS comments 2010-07-25 14:36:53 -04:00
Tim Pope
8a78d1b30e Add spelling support to Sass 2010-07-25 14:33:37 -04:00
Tim Pope
358eb131ec Add 'includeexpr' and 'suffixesadd' to Sass 2010-07-25 13:51:07 -04:00
Tim Pope
6228a6a1ef Support quoted strings after @import 2010-07-25 13:16:33 -04:00
Tim Pope
980b746e31 Add a separate filetype for SCSS 2010-07-25 13:02:54 -04:00
Tim Pope
38b8d33fc3 Further SCSS highlighting 2010-07-25 12:29:13 -04:00
Tim Pope
09d94a600e Tweaks to handling of semicolons in strings 2010-07-22 16:33:11 -04:00
Tim Pope
9c5bdb44ac Sass #{} interpolation support 2010-07-22 16:26:09 -04:00
Tim Pope
a91cdb399d Basic SCSS support 2010-07-22 16:14:04 -04:00
Tim Pope
c583d3a236 Highlight new style Sass variables 2010-07-22 16:07:00 -04:00
Kim Silkebækken
30405bd751 Fixed minor mixin highlighting bug 2010-06-21 17:05:31 -04:00
Tim Pope
d8fd096eca Remove debugging technique 2010-06-18 18:41:24 -04:00
Tim Pope
e36189b912 Lose distinction between SassScript and attributes 2010-06-18 18:11:22 -04:00
Tim Pope
b8414bd238 Highlight Sass functions 2010-06-18 18:10:31 -04:00
Tim Pope
8196ec61cf Support new Sass mixin syntax 2010-06-18 17:48:51 -04:00
Tim Pope
a9c093463f Highlight !default 2010-06-18 17:21:16 -04:00
Bernerd Schaefer
dfb1f770d5 Highlight XML namespaced elements such as '%xsl:stylesheet' 2010-05-28 10:56:01 -04:00
Tim Pope
349f235950 Highlight $constants 2010-05-26 11:44:15 -04:00
Tim Pope
567c6d8f47 Support comma line continuations 2010-05-10 22:46:53 -04:00
Tim Pope
d29da9581f Support :css filter [Brian Gernhardt] 2010-05-10 22:26:15 -04:00
Tim Pope
db4d42dcde Remove commented code 2010-05-10 22:26:15 -04:00
Tim Pope
b80f2c5359 Update email address 2010-05-10 22:22:49 -04:00
Tim Pope
8f9e77eb23 Begin laying groundwork for SassScript support 2009-12-17 22:58:02 -05:00
Tim Pope
f790601bac Highlight @debug 2009-12-17 22:57:34 -05:00
Tim Pope
db054e782e Highlight @else and @else if 2009-12-14 23:18:22 -05:00
Jon Distad
bd62a5eda0 unlet main_syntax at the end of syntax/haml.vim 2009-11-24 13:52:59 -05:00
Tim Pope
5ffacbf2f9 Allow nesting inside curly braces 2009-10-11 16:49:50 -04:00
Tim Pope
cabed106e2 At beginning of line, #{ is interpolation, not id 2009-07-23 15:17:35 -04:00
Tim Pope
d8d48f24b9 Highlight @if, @while, and @for 2009-07-09 09:25:45 -04:00
Tim Pope
4b23eccc45 Fix highlighting of &= and != 2009-07-08 20:15:34 -04:00
Tim Pope
2a8ce3b36e Support Haml 2.2 %a(href="") attribute syntax
The highlighting of event handlers (onclick, etc.) could use some work.
2009-07-08 00:13:26 -04:00
Tim Pope
c745f722af Update helpers to Haml 2.2 2009-07-07 22:59:18 -04:00
Tim Pope
ea667efff7 Support :cdata and :maruku filters 2009-07-07 22:49:18 -04:00
Tim Pope
9dba20dc31 New interpolation rules
- Allow #{} outside of == regions, as in Haml 2.2.
- Allow escaping of #{} with \ along with any \ immediately before #{}.
- Support standalone & and ! at beginning of line.
2009-07-07 22:17:56 -04:00
Tim Pope
3636c3c7ed Disable 'comments' to prevent # insertions 2009-04-02 16:12:07 -04:00
Tim Pope
9f2c7ed4af Skip blank lines in filter regions 2008-11-25 15:55:38 -05:00
Tim Pope
d547b07025 Interpolation in :javascript blocks 2008-10-03 18:04:25 -04:00
Tim Pope
6f3dc2e792 Highlight :javascript filter 2008-09-30 23:46:07 -04:00
Tim Pope
52758326d3 Indent after trailing do 2008-09-11 08:40:39 -04:00
Tim Pope
dd7157447b Support &=, !=, &==, and !== notations 2008-09-03 12:00:26 -04:00
10 changed files with 161 additions and 57 deletions

View File

@@ -1,2 +1,3 @@
autocmd BufNewFile,BufRead *.haml setf haml
autocmd BufNewFile,BufRead *.sass setf sass
autocmd BufNewFile,BufRead *.scss setf scss

View File

@@ -1,6 +1,7 @@
" Vim filetype plugin
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -56,7 +57,7 @@ if exists("loaded_matchit")
let b:match_words = s:match_words
endif
setlocal commentstring=-#\ %s
setlocal comments= commentstring=-#\ %s
let b:undo_ftplugin = "setl cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin

View File

@@ -1,6 +1,7 @@
" Vim filetype plugin
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Jul 26
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -8,11 +9,14 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl cms< inc< ofu<"
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
setlocal commentstring=//\ %s
setlocal define=^\\s*\\%(@mixin\\\|=\\)
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.sass,.scss,.css
let &l:include = '^\s*@import\s\+\%(url(\)\='
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
" vim:set sw=2:

12
ftplugin/scss.vim Normal file
View File

@@ -0,0 +1,12 @@
" Vim filetype plugin
" Language: SCSS
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Jul 26
if exists("b:did_ftplugin")
finish
endif
runtime! ftplugin/sass.vim
" vim:set sw=2:

View File

@@ -1,7 +1,7 @@
" Vim indent file
" Language: HAML
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
if exists("b:did_indent")
finish
@@ -44,8 +44,6 @@ function! GetHamlIndent()
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
"let indent = indent == indent(lnum) ? -1 : indent
"let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent
let group = synIDattr(synID(lnum,lastcol,1),'name')
@@ -53,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\)\>\%(.*\<end\>\)\@!\|.*do |[^|]*|\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
elseif line == '-#'
return increase

View File

@@ -1,7 +1,7 @@
" Vim indent file
" Language: SASS
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
if exists("b:did_indent")
finish
@@ -17,7 +17,7 @@ if exists("*GetSassIndent")
finish
endif
let s:property = '^\s*:\|^\s*[[:alnum:]-]\+:'
let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)'
function! GetSassIndent()
let lnum = prevnonblank(v:lnum-1)

12
indent/scss.vim Normal file
View File

@@ -0,0 +1,12 @@
" Vim indent file
" Language: SCSS
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Jul 26
if exists("b:did_indent")
finish
endif
runtime! indent/css.vim
" vim:set sw=2:

View File

@@ -1,7 +1,8 @@
" Vim syntax file
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Filenames: *.haml
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.haml
" Last Change: 2010 Jul 26
if exists("b:current_syntax")
finish
@@ -20,46 +21,58 @@ syn include @hamlRubyTop syntax/ruby.vim
syn case match
syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter
syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained
syn cluster hamlRubyTop add=rubyCurlyBlock
syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter
syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
syn match hamlBegin "^\s*[<>&]\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable
syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable
syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent
syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
syn match hamlSelfCloser "/" contained
syn match hamlClassChar "\." contained nextgroup=hamlClass
syn match hamlIdChar "#" contained nextgroup=hamlId
syn match hamlIdChar "#{\@!" contained nextgroup=hamlId
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
syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop
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 hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD
syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop
syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape
syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape
syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained
syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,rubyInterpolation
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\)\s*$" end="^\%(\z1 \)\@!" contains=rubyInterpolation
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlInterpolation
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=hamlInterpolation
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop
syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,hamlInterpolation keepend
syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend
syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend
syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend
syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend
syn match hamlError "\$" contained
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo
syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
hi def link hamlSelfCloser Special
@@ -74,6 +87,9 @@ hi def link hamlInterpolatableChar hamlRubyChar
hi def link hamlRubyOutputChar hamlRubyChar
hi def link hamlRubyChar Special
hi def link hamlInterpolationDelimiter Delimiter
hi def link hamlInterpolationEscape Special
hi def link hamlAttributeString String
hi def link hamlAttributeVariable Identifier
hi def link hamlDocType PreProc
hi def link hamlFilter PreProc
hi def link hamlAttributesDelimiter Delimiter
@@ -86,4 +102,8 @@ hi def link hamlError Error
let b:current_syntax = "haml"
if main_syntax == "haml"
unlet main_syntax
endif
" vim:set sw=2:

View File

@@ -1,7 +1,8 @@
" Vim syntax file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Filenames: *.sass
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.sass
" Last Change: 2010 Jul 28
if exists("b:current_syntax")
finish
@@ -12,14 +13,35 @@ runtime! syntax/css.vim
syn case ignore
syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
syn cluster sassCssAttributes contains=css.*Attr,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
syn cluster sassCssAttributes contains=css.*Attr,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
syn match sassProperty "^\s*\zs\s\%([[:alnum:]-]\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
syn match sassCssAttribute ".*$" contained contains=@sassCssAttributes,sassConstant
syn match sassConstant "![[:alnum:]_-]\+"
syn match sassConstantAssignment "\%(![[:alnum:]_]\+\s*\)\@<==" nextgroup=sassCssAttribute skipwhite
syn match sassMixin "^=.*"
syn match sassMixing "^\s\+\zs+.*"
syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
syn match sassProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition
syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction,sassInterpolation
syn match sassDefault "!default\>" contained
syn match sassVariable "!\%(important\>\|default\>\)\@![[:alnum:]_-]\+"
syn match sassVariable "$[[:alnum:]_-]\+"
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite
syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained
syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained
syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained
syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained
syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained
syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained
syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ,sassProperty
syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute
syn match sassMixin "^=" nextgroup=sassMixinName
syn match sassMixin "\%([{};]\s*\|^\s*\)\@<=@mixin" nextgroup=sassMixinName skipwhite
syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName
syn match sassMixing "\%([{};]\s*\|^\s*\)\@<=@include" nextgroup=sassMixinName skipwhite
syn match sassExtend "\%([{};]\s*\|^\s*\)\@<=@extend"
syn match sassEscape "^\s*\zs\\"
syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId
@@ -31,22 +53,34 @@ syn match sassAmpersand "&"
" TODO: Attribute namespaces
" TODO: Arithmetic (including strings and concatenation)
syn region sassInclude start="@import" end=";\|$" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType
syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssURL,cssUnicodeEscape,cssMediaType
syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction
syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction
syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction
syn keyword sassFor from to through contained
syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained
syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo
syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo
syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
hi def link sassCssComment sassComment
hi def link sassComment Comment
hi def link sassConstant Identifier
hi def link sassDefault cssImportant
hi def link sassVariable Identifier
hi def link sassFunction Function
hi def link sassMixing PreProc
hi def link sassMixin PreProc
hi def link sassExtend PreProc
hi def link sassTodo Todo
hi def link sassInclude Include
hi def link sassDebug sassControl
hi def link sassWarn sassControl
hi def link sassControl PreProc
hi def link sassFor PreProc
hi def link sassEscape Special
hi def link sassIdChar Special
hi def link sassClassChar Special
hi def link sassInterpolationDelimiter Delimiter
hi def link sassAmpersand Character
hi def link sassId Identifier
hi def link sassClass Type

20
syntax/scss.vim Normal file
View File

@@ -0,0 +1,20 @@
" Vim syntax file
" Language: SCSS
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.scss
" Last Change: 2010 Jul 26
if exists("b:current_syntax")
finish
endif
runtime! syntax/sass.vim
syn match scssComment "//.*" contains=sassTodo,@Spell
syn region scssComment start="/\*" end="\*/" contains=sassTodo,@Spell
hi def link scssComment sassComment
let b:current_syntax = "scss"
" vim:set sw=2: