Skip to content

Instantly share code, notes, and snippets.

@hail2u
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hail2u/9208756 to your computer and use it in GitHub Desktop.
Save hail2u/9208756 to your computer and use it in GitHub Desktop.
~/.vim/after/syntax/sass.vim (support Sass 3.4.0.rc.2)
" !optional
syn match sassOptional "!optional\>" contained
hi def link sassOptional cssImportant
" !global
syn match sassGlobal "!global\>" contained
hi def link sassGlobal cssImportant
" Functions
syn match sassFunction "\<\%(invert\)\>(\@=" contained
syn match sassFunction "\<\%(adjust-color\|scale-color\|change-color\|ie-hex-str\)\>(\@=" contained
syn match sassFunction "\<\%(str-length\|str-insert\|str-index\|str-slice\|to-upper-case\|to-lower-case\)\>(\@=" contained
syn match sassFunction "\<\%(min\|max\|random\)\>(\@=" contained
syn match sassFunction "\<\%(length\|set-nth\|nth\|join\|append\|zip\|index\|list-separator\)\>(\@=" contained
syn match sassFunction "\<\%(map-get\|map-merge\|map-remove\|map-keys\|map-values\|map-has-key\|keywords\)\>(\@=" contained
syn match sassFunction "\<\%(feature-exists\|variable-exists\|global-variable-exists\|function-exists\|mixin-exists\|inspect\|call\)\>(\@=" contained
syn match sassFunction "\<\%(if\|unique-id\)\>(\@=" contained
syn match sassFunction "\<\%(selector-\(nest\|append\|extend\|repace\|unify\|parse\)\)\>(\@=" contained
syn match sassFunction "\<\%(is-superselector\|simple-selectors\)\>(\@=" contained
" @content
syn match sassContent "\%([{};]\s*\|^\s*\)\@<=@content"
hi def link sassContent PreProc
" @at-root
syn match sassAtRoot "\%([{};]\s*\|^\s*\)\@<=@at-root"
hi def link sassAtRoot PreProc
" @error
syn region sassErrorLine end=";\|$" matchgroup=sassError start="@error\>" contains=@sassCssAttributes,sassVariable,sassFunction
hi def link sassError sassControl
@mixin content() {
@content;
}
.foo {
color: invert(red);
color: adjust-color(#102030, $blue: 5);
color: scale-color(hsl(120, 70%, 80%), $lightness: 50%);
color: change-color(#102030, $blue: 5);
color: ie-hex-str(#abc);
color: str-length("foo");
color: str-insert("abcd", "X", 1);
color: str-index("abcd", a);
color: str-slice("abcd", 2, 3);
color: to-upper-case("ABCD");
color: to-lower-case("ABCD");
color: min(1px, 4px);
color: max(1px, 4px);
color: random(3);
color: length(10px);
color: set-nth($list: 10px 20px 30px, $n: 2, $value: -20px);
color: nth(10px 20px 30px, 1);
color: join(10px 20px, 30px 40px);
color: append(10px 20px, 30px);
color: zip(1px 1px 3px, solid dashed solid, red green blue);
color: index(1px solid red, solid);
color: list-separator(1px 2px 3px);
color: map-get(("foo": 1, "bar": 2), "foo");
color: map-merge(("foo": 1), ("bar": 2));
color: map-remove(("foo": 1, "bar": 2), "bar");
color: map-keys(("foo": 1, "bar": 2));
color: map-values(("foo": 1, "bar": 2));
color: map-has-key(("foo": 1, "bar": 2), "foo");
color: keywords($args);
color: feature-exists(some-feature-that-exists);
color: variable-exists(a-false-value);
color: global-variable-exists(a-false-value);
color: function-exists(lighten);
color: mixin-exists(nonexistent);
color: inspect($val);
color: call(rgb, 10, 100, 255);
color: if(true, 1px, 2px);
color: unique-id();
@include content {
color: green;
}
@at-root .bar {
color: blue;
}
@extend .bar !optional;
$bar: "bar" !global;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment