From 09f31c433a136450b9faa33b08fc3281bdea5acc Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 3 Jan 2021 14:09:55 +0100 Subject: Revert stylus provider --- README.md | 2 +- autoload/polyglot/init.vim | 23 +- autoload/stylcomplete.vim | 578 --------------------- compiler/ocaml.vim | 2 +- extras/filetype.vim | 2 +- ftplugin/fstab.vim | 23 + ftplugin/stylus.vim | 10 +- indent/dune.vim | 2 +- indent/stylus.vim | 95 +++- packages.yaml | 2 +- syntax/basic/function.vim | 14 +- syntax/diff.vim | 17 +- syntax/fstab.vim | 4 +- syntax/odin.vim | 4 +- syntax/sml.vim | 91 ++-- syntax/stylus.vim | 1206 +++++++++++++------------------------------- 16 files changed, 533 insertions(+), 1542 deletions(-) delete mode 100644 autoload/stylcomplete.vim create mode 100644 ftplugin/fstab.vim diff --git a/README.md b/README.md index fd9bf7d9..afaecd1b 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [slime](https://github.com/slime-lang/vim-slime-syntax) (Syntax highlighting for slime files) - [smt2](https://github.com/bohlender/vim-smt2) (SMT syntax highlighting for smt2 and smt files) - [solidity](https://github.com/tomlion/vim-solidity) (Solidity syntax highlighting for sol files) -- [stylus](https://github.com/iloginow/vim-stylus) (Stylus syntax highlighting for styl and stylus files) +- [stylus](https://github.com/wavded/vim-stylus) (Stylus syntax highlighting for styl and stylus files) - [svelte](https://github.com/evanleck/vim-svelte/tree/main) (Svelte syntax highlighting for svelte files) - [svg-indent](https://github.com/jasonshell/vim-svg-indent) - [svg](https://github.com/vim-scripts/svg.vim) (SVG syntax highlighting for svg files) diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim index 9d01b346..8af31ec2 100644 --- a/autoload/polyglot/init.vim +++ b/autoload/polyglot/init.vim @@ -21,19 +21,20 @@ func! polyglot#init#init() endfunc func! polyglot#init#is_disabled(caller, name, path) - if g:polyglot_initialized - return has_key(g:polyglot_is_disabled, a:name) + if !g:polyglot_initialized + if a:path[0:7] == "autoload" + let g:polyglot_initialized = 1 + + for p in globpath(&rtp, a:path, 0, 1) + if p != a:caller + exe "source " . p + return 1 + endif + endfor + endif endif - if a:path[0:7] == "autoload" - let g:polyglot_initialized = 1 - for p in globpath(&rtp, a:path, 0, 1) - if p != a:caller - exe "source " . p - return 1 - endif - endfor - endif + return has_key(g:polyglot_is_disabled, a:name) endfunc let g:polyglot_is_disabled = {} diff --git a/autoload/stylcomplete.vim b/autoload/stylcomplete.vim deleted file mode 100644 index 654d405a..00000000 --- a/autoload/stylcomplete.vim +++ /dev/null @@ -1,578 +0,0 @@ -if polyglot#init#is_disabled(expand(':p'), 'stylus', 'autoload/stylcomplete.vim') - finish -endif - -" Vim completion script -" Language: Stylus -" Author: Ilia Loginov -" Created: 2018 Jan 28 - -fun! stylcomplete#CompleteStyl(findstart, base) - - if a:findstart - let line = getline('.') - let start = col('.') - 1 - while start > 0 && line[start - 1] !~ '\(\s\|\[\|(\|{\|:\)' - let start -= 1 - endwhile - let b:start = line[start] - let b:before = line[start - 1] - let b:line = line[0:col('.')] - let b:first_char = matchstrpos(b:line, '^\s*\S')[2] - let b:first_word_type = synIDattr(synID(line('.'), b:first_char, 1), 'name') - " Check if there is more than one word on the current line - let b:word_break = 0 - if b:line =~ '^.*\S\(\s\|\[\|(\|{\|:\)\S.*' - let b:word_break = 1 - endif - return start - endif - - " Complete properties - if b:start =~ '\w' && b:word_break == 0 - let res = [] - for m in g:css_props - if m =~ '^' . a:base - call add(res, m) - endif - endfor - return res - - " Complete pseudo classes and elements - elseif b:before == ':' && b:first_word_type =~ 'stylusSelector\w*' - let values = ["active", "any", "any-link", "blank", "checked", "cue", "cue-region", "disabled", "enabled", "default", "dir(", "disabled", "drop", "drop(", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "future", "focus", "focus-within", "has(", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "matches(", "not(", "nth-child(", "nth-column(", "nth-last-child(", "nth-last-column(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "past", "paused", "placeholder-shown", "playing", "read-only", "read-write", "required", "right", "root", "scope", "target", "user-invalid", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"] - - let res = [] - for m in values - if m =~ '^' . a:base - call add(res, m) - endif - endfor - return res - - " Complete !important and !optional - elseif b:start == '!' && b:word_break == 1 && b:first_word_type == 'stylusProperty' - let values = ["important", "optional"] - - let res = [] - for m in values - if m =~ '^' . a:base - call add(res, m) - endif - endfor - return res - - " Complete values - elseif b:start =~ '\w' && b:word_break == 1 && b:first_word_type == 'stylusProperty' - let prop = matchstr(b:line, '\(^\s\+\)\@<=\<\(\w\|-\)\+\>') - let res = [] - - let wide_keywords = ["initial", "inherit", "unset"] - let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"] + g:css_colors - let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - let border_width_values = ["thin", "thick", "medium"] - let list_style_type_values = ["decimal", "decimal-leading-zero", "arabic-indic", "armenian", "upper-armenian", "lower-armenian", "bengali", "cambodian", "khmer", "cjk-decimal", "devanagari", "georgian", "gujarati", "gurmukhi", "hebrew", "kannada", "lao", "malayalam", "mongolian", "myanmar", "oriya", "persian", "lower-roman", "upper-roman", "tamil", "telugu", "thai", "tibetan", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "cjk-earthly-branch", "cjk-heavenly-stem", "lower-greek", "hiragana", "hiragana-iroha", "katakana", "katakana-iroha", "disc", "circle", "square", "disclosure-open", "disclosure-closed"] - let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"] - - if prop == 'all' - - let values = [] - elseif prop == 'additive-symbols' - let values = [] - elseif prop == 'align-content' - let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"] - elseif prop == 'align-items' - let values = ["flex-start", "flex-end", "center", "baseline", "stretch"] - elseif prop == 'align-self' - let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"] - elseif prop == 'animation' - let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"] - elseif prop == 'animation-delay' - let values = [] - elseif prop == 'animation-direction' - let values = ["normal", "reverse", "alternate", "alternate-reverse"] - elseif prop == 'animation-duration' - let values = [] - elseif prop == 'animation-fill-mode' - let values = ["none", "forwards", "backwards", "both"] - elseif prop == 'animation-iteration-count' - let values = [] - elseif prop == 'animation-name' - let values = [] - elseif prop == 'animation-play-state' - let values = ["running", "paused"] - elseif prop == 'animation-timing-function' - let values = timing_functions - elseif prop == 'appearance' - let values = ["auto", "none"] - elseif prop == 'background-attachment' - let values = ["scroll", "fixed"] - elseif prop == 'background-color' - let values = color_values - elseif prop == 'background-image' - let values = ["url(", "none"] - elseif prop == 'background-position' - let vals = matchstr(b:line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z]\+\)\?$' - let values = ["top", "center", "bottom"] - elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["left", "center", "right"] - else - return [] - endif - elseif prop == 'background-repeat' - let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] - elseif prop == 'background-size' - let values = ["auto", "contain", "cover"] - elseif prop == 'background' - let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"] - elseif prop =~ '^border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$' - let vals = matchstr(b:line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = border_width_values - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = border_style_values - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = color_values - else - return [] - endif - elseif prop =~ '^border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color' - let values = color_values - elseif prop =~ '^border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style' - let values = border_style_values - elseif prop =~ '^border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width' - let values = border_width_values - elseif prop == 'border-color' - let values = color_values - elseif prop == 'border-style' - let values = border_style_values - elseif prop == 'border-width' - let values = border_width_values - elseif prop == 'bottom' - let values = ["auto"] - elseif prop == 'box-decoration-break' - let values = ["slice", "clone"] - elseif prop == 'box-shadow' - let values = ["inset"] - elseif prop == 'box-sizing' - let values = ["border-box", "content-box"] - elseif prop =~ '^break-\%(before\|after\)' - let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"] - elseif prop == 'break-inside' - let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"] - elseif prop == 'caption-side' - let values = ["top", "bottom"] - elseif prop == 'clear' - let values = ["none", "left", "right", "both"] - elseif prop == 'clip' - let values = ["auto", "rect("] - elseif prop == 'clip-path' - let values = ["fill-box", "stroke-box", "view-box", "none"] - elseif prop == 'color' - let values = color_values - elseif prop == 'columns' - let values = [] - elseif prop == 'column-count' - let values = ['auto'] - elseif prop == 'column-fill' - let values = ['auto', 'balance'] - elseif prop == 'column-rule-color' - let values = color_values - elseif prop == 'column-rule-style' - let values = border_style_values - elseif prop == 'column-rule-width' - let values = border_width_values - elseif prop == 'column-rule' - let vals = matchstr(b:line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = border_width_values - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = border_style_values - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = color_values - else - return [] - endif - elseif prop == 'column-span' - let values = ["none", "all"] - elseif prop == 'column-width' - let values = ["auto"] - elseif prop == 'content' - let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] - elseif prop =~ '^counter-\%(increment\|reset\)$' - let values = ["none"] - elseif prop =~ '^cue\%(-after\|-before\)\=$' - let values = ["url("] - elseif prop == 'cursor' - let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] - elseif prop == 'direction' - let values = ["ltr", "rtl"] - elseif prop == 'display' - let values = ["inline", "block", "list-item", "run-in", "inline-block", "table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none", "flex", "inline-flex", "grid", "inline-grid", "inline-table", "inline-list-item", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"] - elseif prop == 'elevation' - let values = ["below", "level", "above", "higher", "lower"] - elseif prop == 'empty-cells' - let values = ["show", "hide"] - elseif prop == 'fallback' - let values = list_style_type_values - elseif prop == 'filter' - let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("] - elseif prop == 'flex-basis' - let values = ["auto", "content"] - elseif prop == 'flex-direction' - let values = ["row", "row-reverse", "column", "column-reverse"] - elseif prop == 'flex-flow' - let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] - elseif prop == 'flex-grow' - let values = [] - elseif prop == 'flex-shrink' - let values = [] - elseif prop == 'flex-wrap' - let values = ["nowrap", "wrap", "wrap-reverse"] - elseif prop == 'flex' - let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"] - elseif prop == 'float' - let values = ["left", "right", "none"] - elseif prop == 'font-display' - let values = ["auto", "block", "swap", "fallback", "optional"] - elseif prop == 'font-family' - let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy", "system-ui", "emoji", "math", "fangsong"] - elseif prop == 'font-feature-settings' - let values = ["normal", '"aalt"', '"abvf"', '"abvm"', '"abvs"', '"afrc"', '"akhn"', '"blwf"', '"blwm"', '"blws"', '"calt"', '"case"', '"ccmp"', '"cfar"', '"cjct"', '"clig"', '"cpct"', '"cpsp"', '"cswh"', '"curs"', '"cv', '"c2pc"', '"c2sc"', '"dist"', '"dlig"', '"dnom"', '"dtls"', '"expt"', '"falt"', '"fin2"', '"fin3"', '"fina"', '"flac"', '"frac"', '"fwid"', '"half"', '"haln"', '"halt"', '"hist"', '"hkna"', '"hlig"', '"hngl"', '"hojo"', '"hwid"', '"init"', '"isol"', '"ital"', '"jalt"', '"jp78"', '"jp83"', '"jp90"', '"jp04"', '"kern"', '"lfbd"', '"liga"', '"ljmo"', '"lnum"', '"locl"', '"ltra"', '"ltrm"', '"mark"', '"med2"', '"medi"', '"mgrk"', '"mkmk"', '"mset"', '"nalt"', '"nlck"', '"nukt"', '"numr"', '"onum"', '"opbd"', '"ordn"', '"ornm"', '"palt"', '"pcap"', '"pkna"', '"pnum"', '"pref"', '"pres"', '"pstf"', '"psts"', '"pwid"', '"qwid"', '"rand"', '"rclt"', '"rkrf"', '"rlig"', '"rphf"', '"rtbd"', '"rtla"', '"rtlm"', '"ruby"', '"salt"', '"sinf"', '"size"', '"smcp"', '"smpl"', '"ss01"', '"ss02"', '"ss03"', '"ss04"', '"ss05"', '"ss06"', '"ss07"', '"ss08"', '"ss09"', '"ss10"', '"ss11"', '"ss12"', '"ss13"', '"ss14"', '"ss15"', '"ss16"', '"ss17"', '"ss18"', '"ss19"', '"ss20"', '"ssty"', '"stch"', '"subs"', '"sups"', '"swsh"', '"titl"', '"tjmo"', '"tnam"', '"tnum"', '"trad"', '"twid"', '"unic"', '"valt"', '"vatu"', '"vert"', '"vhal"', '"vjmo"', '"vkna"', '"vkrn"', '"vpal"', '"vrt2"', '"zero"'] - elseif prop == 'font-kerning' - let values = ["auto", "normal", "none"] - elseif prop == 'font-language-override' - let values = ["normal"] - elseif prop == 'font-size' - let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] - elseif prop == 'font-size-adjust' - let values = [] - elseif prop == 'font-stretch' - let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"] - elseif prop == 'font-style' - let values = ["normal", "italic", "oblique"] - elseif prop == 'font-synthesis' - let values = ["none", "weight", "style"] - elseif prop == 'font-variant-alternates' - let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] - elseif prop == 'font-variant-caps' - let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] - elseif prop == 'font-variant-asian' - let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] - elseif prop == 'font-variant-ligatures' - let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] - elseif prop == 'font-variant-numeric' - let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] - elseif prop == 'font-variant-position' - let values = ["normal", "sub", "super"] - elseif prop == 'font-variant' - let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + ["small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + ["ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + ["none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + ["ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + ["sub", "super"] - elseif prop == 'font-weight' - let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] - elseif prop == 'font' - let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "system-ui", "emoji", "math", "fangsong", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"] - elseif prop =~ '^\%(height\|width\)$' - let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] - elseif prop =~ '^\%(left\|rigth\)$' - let values = ["auto"] - elseif prop == 'image-rendering' - let values = ["auto", "crisp-edges", "pixelated"] - elseif prop == 'image-orientation' - let values = ["from-image", "flip"] - elseif prop == 'ime-mode' - let values = ["auto", "normal", "active", "inactive", "disabled"] - elseif prop == 'inline-size' - let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] - elseif prop == 'isolation' - let values = ["auto", "isolate"] - elseif prop == 'justify-content' - let values = ["flex-start", "flex-end", "center", "space-between", "space-around"] - elseif prop == 'letter-spacing' - let values = ["normal"] - elseif prop == 'line-break' - let values = ["auto", "loose", "normal", "strict"] - elseif prop == 'line-height' - let values = ["normal"] - elseif prop == 'list-style-image' - let values = ["url(", "none"] - elseif prop == 'list-style-position' - let values = ["inside", "outside"] - elseif prop == 'list-style-type' - let values = list_style_type_values - elseif prop == 'list-style' - let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"] - elseif prop == 'margin' - let values = ["auto"] - elseif prop =~ '^margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$' - let values = ["auto"] - elseif prop == 'marks' - let values = ["crop", "cross", "none"] - elseif prop == 'mask' - let values = ["url("] - elseif prop == 'mask-type' - let values = ["luminance", "alpha"] - elseif prop == '\%(max\|min\)-\%(block\|inline\)-size' - let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] - elseif prop == '\%(max\|min\)-\%(height\|width\)' - let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] - elseif prop == '\%(max\|min\)-zoom' - let values = ["auto"] - elseif prop == 'mix-blend-mode' - let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"] - elseif prop == 'object-fit' - let values = ['fill', 'contain', 'cover', 'scale-down'] - elseif prop == 'opacity' - let values = [] - elseif prop == 'orientation' - let values = ["auto", "portrait", "landscape"] - elseif prop == 'orphans' - let values = [] - elseif prop == 'outline-offset' - let values = [] - elseif prop == 'outline-color' - let values = color_values - elseif prop == 'outline-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop == 'outline-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'outline' - let vals = matchstr(b:line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' - let values = color_values - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["thin", "thick", "medium"] - else - return [] - endif - elseif prop == 'overflow-wrap' - let values = ["normal", "break-word"] - elseif prop =~ '^overflow\%(-x\|-y\)\=' - let values = ["visible", "hidden", "scroll", "auto"] - elseif prop == 'pad' - let values = [] - elseif prop == 'padding' - let values = [] - elseif prop =~ '^padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$' - let values = [] - elseif prop =~ '^page-break-\%(after\|before\)$' - let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"] - elseif prop == 'page-break-inside' - let values = ["auto", "avoid"] - elseif prop =~ '^pause\%(-after\|-before\)\=$' - let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] - elseif prop == 'perspective' - let values = ["none"] - elseif prop == 'perspective-origin' - let values = ["top", "bottom", "left", "center", " right"] - elseif prop == 'pointer-events' - let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"] - elseif prop == 'position' - let values = ["static", "relative", "absolute", "fixed", "sticky"] - elseif prop == 'prefix' - let values = [] - elseif prop == 'quotes' - let values = ["none"] - elseif prop == 'range' - let values = ["auto", "infinite"] - elseif prop == 'resize' - let values = ["none", "both", "horizontal", "vertical"] - elseif prop =~ '^rest\%(-after\|-before\)\=$' - let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] - elseif prop == 'ruby-align' - let values = ["start", "center", "space-between", "space-around"] - elseif prop == 'ruby-merge' - let values = ["separate", "collapse", "auto"] - elseif prop == 'ruby-position' - let values = ["over", "under", "inter-character"] - elseif prop == 'scroll-behavior' - let values = ["auto", "smooth"] - elseif prop == 'scroll-snap-coordinate' - let values = ["none"] - elseif prop == 'scroll-snap-destination' - return [] - elseif prop == 'scroll-snap-points-\%(x\|y\)$' - let values = ["none", "repeat("] - elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$' - let values = ["none", "mandatory", "proximity"] - elseif prop == 'shape-image-threshold' - let values = [] - elseif prop == 'shape-margin' - let values = [] - elseif prop == 'shape-outside' - let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url('] - elseif prop == 'speak' - let values = ["auto", "none", "normal"] - elseif prop == 'speak-as' - let values = ["auto", "normal", "spell-out", "digits"] - elseif prop == 'src' - let values = ["url("] - elseif prop == 'suffix' - let values = [] - elseif prop == 'symbols' - let values = [] - elseif prop == 'system' - let vals = matchstr(b:line, '.*:\s*\zs.*') - if vals =~ '^extends' - let values = list_style_type_values - else - let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"] - endif - elseif prop == 'table-layout' - let values = ["auto", "fixed"] - elseif prop == 'tab-size' - let values = [] - elseif prop == 'text-align' - let values = ["start", "end", "left", "right", "center", "justify", "match-parent"] - elseif prop == 'text-align-last' - let values = ["auto", "start", "end", "left", "right", "center", "justify"] - elseif prop == 'text-combine-upright' - let values = ["none", "all", "digits"] - elseif prop == 'text-decoration-line' - let values = ["none", "underline", "overline", "line-through", "blink"] - elseif prop == 'text-decoration-color' - let values = color_values - elseif prop == 'text-decoration-style' - let values = ["solid", "double", "dotted", "dashed", "wavy"] - elseif prop == 'text-decoration' - let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values - elseif prop == 'text-emphasis-color' - let values = color_values - elseif prop == 'text-emphasis-position' - let values = ["over", "under", "left", "right"] - elseif prop == 'text-emphasis-style' - let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] - elseif prop == 'text-emphasis' - let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] - elseif prop == 'text-indent' - let values = ["hanging", "each-line"] - elseif prop == 'text-orientation' - let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"] - elseif prop == 'text-overflow' - let values = ["clip", "ellipsis", "fade", "fade("] - elseif prop == 'text-rendering' - let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"] - elseif prop == 'text-shadow' - let values = color_values - elseif prop == 'text-transform' - let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"] - elseif prop == 'text-underline-position' - let values = ["auto", "under", "left", "right"] - elseif prop == 'touch-action' - let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"] - elseif prop == 'transform' - let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("] - elseif prop == 'transform-box' - let values = ["border-box", "fill-box", "view-box"] - elseif prop == 'transform-origin' - let values = ["left", "center", "right", "top", "bottom"] - elseif prop == 'transform-style' - let values = ["flat", "preserve-3d"] - elseif prop == 'top' - let values = ["auto"] - elseif prop == 'transition-property' - let values = ["all", "none"] + g:css_animatable_props - elseif prop == 'transition-duration' - let values = [] - elseif prop == 'transition-delay' - let values = [] - elseif prop == 'transition-timing-function' - let values = timing_functions - elseif prop == 'transition' - let values = ["all", "none"] + g:css_animatable_props + timing_functions - elseif prop == 'unicode-bidi' - let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"] - elseif prop == 'unicode-range' - let values = ["U+"] - elseif prop == 'user-select' - let values = ["auto", "text", "none", "contain", "all"] - elseif prop == 'user-zoom' - let values = ["zoom", "fixed"] - elseif prop == 'vertical-align' - let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] - elseif prop == 'visibility' - let values = ["visible", "hidden", "collapse"] - elseif prop == 'voice-volume' - let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] - elseif prop == 'voice-balance' - let values = ["left", "center", "right", "leftwards", "rightwards"] - elseif prop == 'voice-family' - let values = [] - elseif prop == 'voice-rate' - let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"] - elseif prop == 'voice-pitch' - let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] - elseif prop == 'voice-range' - let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] - elseif prop == 'voice-stress' - let values = ["normal", "strong", "moderate", "none", "reduced "] - elseif prop == 'voice-duration' - let values = ["auto"] - elseif prop == 'white-space' - let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] - elseif prop == 'widows' - let values = [] - elseif prop == 'will-change' - let values = ["auto", "scroll-position", "contents"] + s:values - elseif prop == 'word-break' - let values = ["normal", "break-all", "keep-all"] - elseif prop == 'word-spacing' - let values = ["normal"] - elseif prop == 'word-wrap' - let values = ["normal", "break-word"] - elseif prop == 'writing-mode' - let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"] - elseif prop == 'z-index' - let values = ["auto"] - elseif prop == 'zoom' - let values = ["auto"] - else - let values = wide_keywords - endif - - let values = values + wide_keywords - - for m in values - if m =~ '^' . a:base - call add(res, m) - endif - endfor - return res - - " Complete @-rules - - elseif b:start =~ '\w' && b:word_break == 1 && b:first_word_type == 'stylusAtRuleMedia' - - let values = ["min-width", "min-height", "max-width", "max-height"] - - let res = [] - - for m in values - if m =~ '^' . a:base - call add(res, m . ': ') - endif - endfor - - return res - - elseif b:start == '@' - - let values = ["@media", "@import", "@extend", "@block", "@charset", "@page", "@font-face", "@namespace", "@supports", "@keyframes", "@viewport", "@document", "@css"] - - let res = [] - - for m in values - if m =~ '^' . a:base - call add(res, m .' ') - endif - endfor - - return res - - endif - - return [] - -endfun diff --git a/compiler/ocaml.vim b/compiler/ocaml.vim index 3ad94741..cc45414a 100644 --- a/compiler/ocaml.vim +++ b/compiler/ocaml.vim @@ -5,7 +5,7 @@ endif " Vim Compiler File " Compiler: ocaml " Maintainer: Markus Mottl -" URL: http://www.ocaml.info/vim/compiler/ocaml.vim +" URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2020 Mar 28 - Improved error format (Thomas Leonard) " 2017 Nov 26 - Improved error format (Markus Mottl) diff --git a/extras/filetype.vim b/extras/filetype.vim index 20fa887e..703ff96e 100644 --- a/extras/filetype.vim +++ b/extras/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2020 Dec 07 +" Last Change: 2020 Dec 24 " Listen very carefully, I will say this only once if exists("did_load_filetypes") diff --git a/ftplugin/fstab.vim b/ftplugin/fstab.vim new file mode 100644 index 00000000..5f0972ca --- /dev/null +++ b/ftplugin/fstab.vim @@ -0,0 +1,23 @@ +if polyglot#init#is_disabled(expand(':p'), 'fstab', 'ftplugin/fstab.vim') + finish +endif + +" Vim ftplugin file +" Language: fstab file +" Maintainer: Radu Dineiu +" URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim +" Last Change: 2020 Dec 29 +" Version: 1.0 +" +" Credits: +" Subhaditya Nath + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s +let b:undo_ftplugin = "setlocal commentstring<" + +" vim: ts=8 ft=vim \ No newline at end of file diff --git a/ftplugin/stylus.vim b/ftplugin/stylus.vim index e24bea01..ce334497 100644 --- a/ftplugin/stylus.vim +++ b/ftplugin/stylus.vim @@ -4,8 +4,8 @@ endif " Vim filetype plugin " Language: Stylus -" Maintainer: Ilia Loginov -" Credits: Marc Harter, Tim Pope +" Maintainer: Marc Harter +" Credits: Tim Pope " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -47,14 +47,14 @@ if exists("loaded_matchit") let b:match_words = s:match_words endif +setlocal comments= commentstring=//\ %s + setlocal suffixesadd=.styl " Add '-' and '#' to the what makes up a keyword. " This means that 'e' and 'w' work properly now, for properties " and valid variable names. -setlocal iskeyword+=#,- - -setlocal omnifunc=stylcomplete#CompleteStyl +setl iskeyword+=#,- let b:undo_ftplugin = "setl cms< com< " \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin diff --git a/indent/dune.vim b/indent/dune.vim index 5dbe9d30..009f7eba 100644 --- a/indent/dune.vim +++ b/indent/dune.vim @@ -14,4 +14,4 @@ endif let b:did_indent = 1 " dune format-dune-file uses 1 space to indent -set softtabstop=1 shiftwidth=1 expandtab +setlocal softtabstop=1 shiftwidth=1 expandtab diff --git a/indent/stylus.vim b/indent/stylus.vim index 1254ebc3..88aa4482 100644 --- a/indent/stylus.vim +++ b/indent/stylus.vim @@ -4,21 +4,21 @@ endif " Vim indent file " Language: Stylus -" Maintainer: Ilia Loginov -" Last Change: 2018 Jan 19 +" Maintainer: Marc Harter +" Last Change: 2010 May 21 " Based On: sass.vim from Tim Pope - +" if exists("b:did_indent") finish endif +unlet! b:did_indent let b:did_indent = 1 setlocal indentexpr=GetStylusIndent() -setlocal autoindent nolisp nosmartindent -setlocal indentkeys=o,O,*,0),!^F +setlocal indentkeys=o,O,*,},],0),!^F setlocal formatoptions+=r -if exists('*GetStylusIndent') +if exists("*GetStylusIndent") " only define once finish endif @@ -43,7 +43,45 @@ function s:prevnonblanknoncomment(lnum) return lnum endfunction -function GetStylusIndent() +function s:count_braces(lnum, count_open) + let n_open = 0 + let n_close = 0 + let line = getline(a:lnum) + let pattern = '[{}]' + let i = match(line, pattern) + while i != -1 + if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'css\%(Comment\|StringQ\{1,2}\)' + if line[i] == '{' + let n_open += 1 + elseif line[i] == '}' + if n_open > 0 + let n_open -= 1 + else + let n_close += 1 + endif + endif + endif + let i = match(line, pattern, i + 1) + endwhile + return a:count_open ? n_open : n_close +endfunction + +" function CheckCSSIndent() +" let line = getline(v:lnum) +" if line =~ '^\s*\*' +" return cindent(v:lnum) +" endif +" +" let pnum = s:prevnonblanknoncomment(v:lnum - 1) +" if pnum == 0 +" return 0 +" endif +" +" return indent(pnum) + s:count_braces(pnum, 1) * &sw +" \ - s:count_braces(v:lnum, 0) * &sw +" endfunction + +function! GetStylusIndent() let line = getline(v:lnum) if line =~ '^\s*\*' return cindent(v:lnum) @@ -54,41 +92,42 @@ function GetStylusIndent() return 0 endif - let lnum = prevnonblank(v:lnum-1) + let lnum = prevnonblank(v:lnum-1) if lnum == 0 return 0 endif let pline = getline(pnum) - " Get last line strip ending whitespace - let line = substitute(getline(lnum),'[\s()]\+$','','') - " Get current line, trimmed - let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') - " Get last col in prev line - let lastcol = strlen(line) - " Then remove preceeding whitespace - let line = substitute(line,'^\s\+','','') - " Get indent on prev line - let indent = indent(lnum) - " Get indent on current line - let cindent = indent(v:lnum) - " Increase indent by the shift width - let increase = indent + &sw + if pline =~ '[}{]' + return indent(pnum) + s:count_braces(pnum, 1) * &sw - s:count_braces(v:lnum, 0) * &sw + endif + + let line = substitute(getline(lnum),'[\s()]\+$','','') " get last line strip ending whitespace + let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') " get current line, trimmed + let lastcol = strlen(line) " get last col in prev line + let line = substitute(line,'^\s\+','','') " then remove preceeding whitespace + let indent = indent(lnum) " get indent on prev line + let cindent = indent(v:lnum) " get indent on current line + let increase = indent + &sw " increase indent by the shift width if indent == indent(lnum) let indent = cindent <= indent ? indent : increase endif - let group = synIDattr(synID(lnum, cindent + 1, 1), 'name') + let group = synIDattr(synID(lnum,lastcol,1),'name') - if group =~ 'stylusSelector\w*' - return increase - elseif group =~ 'stylusAtRule\(Viewport\|Page\|Supports\|Document\|Font\|Keyframes\)\w*' + " for debugging only + echo group + + " if group !~? 'css.*' && line =~? ')\s*$' " match user functions + " return increase + if group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudo|stylusId|stylusClass)$' return increase - " Mixin or function definition - elseif group =~ 'stylusFunction\w*' && indent(lnum) == 0 + elseif (group == 'stylusUserFunction') && (indent(lnum) == '0') " mixin definition return increase else return indent endif endfunction + +" vim:set sw=2; diff --git a/packages.yaml b/packages.yaml index 5103de98..3b6a7623 100644 --- a/packages.yaml +++ b/packages.yaml @@ -1564,7 +1564,7 @@ filetypes: - sol --- name: stylus -remote: iloginow/vim-stylus +remote: wavded/vim-stylus filetypes: - name: stylus linguist: Stylus diff --git a/syntax/basic/function.vim b/syntax/basic/function.vim index 88dc901f..6e804e24 100644 --- a/syntax/basic/function.vim +++ b/syntax/basic/function.vim @@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand(':p'), 'typescript', 'syntax/basic/fu endif syntax keyword typescriptAsyncFuncKeyword async - \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef + \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef,typescriptArrowFuncTypeParameter \ skipwhite syntax keyword typescriptAsyncFuncKeyword await @@ -28,18 +28,22 @@ syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ \ skipwhite skipempty syntax match typescriptArrowFuncDef contained /(\%(\_[^()]\+\|(\_[^()]*)\)*)\_s*=>/ - \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ contains=typescriptArrowFuncArg,typescriptArrowFunc,@typescriptCallSignature \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty -syntax region typescriptArrowFuncDef contained start=/(\%(\_[^()]\+\|(\_[^()]*)\)*):/ end=/=>/ - \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation +syntax region typescriptArrowFuncDef contained start=/(\%(\_[^()]\+\|(\_[^()]*)\)*):/ matchgroup=typescriptArrowFunc end=/=>/ + \ contains=typescriptArrowFuncArg,typescriptTypeAnnotation,@typescriptCallSignature \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty keepend +syntax region typescriptArrowFuncTypeParameter start=// + \ contains=@typescriptTypeParameterCluster + \ nextgroup=typescriptArrowFuncDef + \ contained skipwhite skipnl + syntax match typescriptArrowFunc /=>/ syntax match typescriptArrowFuncArg contained /\K\k*/ -syntax region typescriptArrowFuncArg contained start=/<\|(/ end=/\ze=>/ contains=@typescriptCallSignature syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock diff --git a/syntax/diff.vim b/syntax/diff.vim index 6e1306dc..e897a917 100644 --- a/syntax/diff.vim +++ b/syntax/diff.vim @@ -6,7 +6,7 @@ endif " Language: Diff (context or unified) " Maintainer: Bram Moolenaar " Translations by Jakson Alves de Aquino. -" Last Change: 2020 Dec 07 +" Last Change: 2020 Dec 30 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -352,11 +352,16 @@ syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*" syn match diffFile "^diff\>.*" syn match diffFile "^Index: .*" syn match diffFile "^==== .*" -" Old style diff uses *** for old and --- for new. -" Unified diff uses --- for old and +++ for new; names are wrong but it works. -syn match diffOldFile "^+++ .*" -syn match diffOldFile "^\*\*\* .*" -syn match diffNewFile "^--- .*" + +if search('^@@ -\S\+ +\S\+ @@', 'nw', '', 100) + " unified + syn match diffOldFile "^--- .*" + syn match diffNewFile "^+++ .*" +else + " context / old style + syn match diffOldFile "^\*\*\* .*" + syn match diffNewFile "^--- .*" +endif " Used by git syn match diffIndexLine "^index \x\x\x\x.*" diff --git a/syntax/fstab.vim b/syntax/fstab.vim index d87a2ee4..7e234ee8 100644 --- a/syntax/fstab.vim +++ b/syntax/fstab.vim @@ -5,8 +5,8 @@ endif " Vim syntax file " Language: fstab file " Maintainer: Radu Dineiu -" URL: https://raw.github.com/rid9/vim-fstab/master/fstab.vim -" Last Change: 2020 Aug 06 +" URL: https://raw.github.com/rid9/vim-fstab/master/syntax/fstab.vim +" Last Change: 2020 Dec 30 " Version: 1.4 " " Credits: diff --git a/syntax/odin.vim b/syntax/odin.vim index 6597aeda..bafd9575 100644 --- a/syntax/odin.vim +++ b/syntax/odin.vim @@ -64,8 +64,7 @@ syntax keyword odinDefer defer syntax region odinChar start=/\v'/ skip=/\v\\./ end=/\v'/ syntax region odinString start=/\v"/ skip=/\v\\./ end=/\v"/ -syntax match odinFunction "\v<\w*>(\s*::\s*)@=" -syntax match odinDynamicFunction "\v<\w*(\s*:\=\s*\(.*\))@=" +syntax match odinFunction "\v<\w*>(\s*::\s*proc)@=" syntax match odinTagNote "@\<\w\+\>" display @@ -145,7 +144,6 @@ highlight link odinBitField Structure highlight link odinBitSet Structure highlight link odinFunction Function -highlight link odinDynamicFunction Function highlight link odinMacro Macro highlight link odinIf Conditional diff --git a/syntax/sml.vim b/syntax/sml.vim index 10bca3ba..26347128 100644 --- a/syntax/sml.vim +++ b/syntax/sml.vim @@ -7,13 +7,16 @@ endif " Filenames: *.sml *.sig " Maintainers: Markus Mottl " Fabrizio Zeno Cornelli -" URL: http://www.ocaml.info/vim/syntax/sml.vim -" Last Change: 2006 Oct 23 - Fixed character highlighting bug (MM) -" 2002 Jun 02 - Fixed small typo (MM) -" 2001 Nov 20 - Fixed small highlighting bug with modules (MM) +" Last Change: 2019 Oct 01 - Only spell check strings & comments (Chuan Wei Foo) +" 2015 Aug 31 - Fixed opening of modules (Ramana Kumar) +" 2006 Oct 23 - Fixed character highlighting bug (MM) " quit when a syntax file was already loaded if exists("b:current_syntax") + +" Disable spell checking of syntax. +syn spell notoplevel + finish endif @@ -56,7 +59,7 @@ syn region smlEncl transparent matchgroup=smlKeyword start="#\[" matchgroup=sm " Comments -syn region smlComment start="(\*" end="\*)" contains=smlComment,smlTodo +syn region smlComment start="(\*" end="\*)" contains=smlComment,smlTodo,@Spell syn keyword smlTodo contained TODO FIXME XXX @@ -86,7 +89,7 @@ syn region smlSig matchgroup=smlModule start="\" matchgroup=smlModule en syn region smlModSpec matchgroup=smlKeyword start="\" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contained contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlModTRWith,smlMPRestr " "open" -syn region smlNone matchgroup=smlKeyword start="\" matchgroup=smlModule end="\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment +syn region smlNone matchgroup=smlKeyword start="\" matchgroup=smlModule end="\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment " "structure" - somewhat complicated stuff ;-) syn region smlModule matchgroup=smlKeyword start="\<\(structure\|functor\)\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlPreDef @@ -140,7 +143,7 @@ syn match smlModPath "\u\(\w\|'\)*\."he=e-1 syn match smlCharacter +#"\\""\|#"."\|#"\\\d\d\d"+ syn match smlCharErr +#"\\\d\d"\|#"\\\d"+ -syn region smlString start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region smlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell syn match smlFunDef "=>" syn match smlRefAssign ":=" @@ -153,9 +156,9 @@ syn match smlKeyChar ";" syn match smlKeyChar "\*" syn match smlKeyChar "=" -syn match smlNumber "\<-\=\d\+\>" -syn match smlNumber "\<-\=0[x|X]\x\+\>" -syn match smlReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=[fl]\=\>" +syn match smlNumber "\<-\=\d\+\>" +syn match smlNumber "\<-\=0[x|X]\x\+\>" +syn match smlReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=[fl]\=\>" " Synchronization syn sync minlines=20 @@ -171,49 +174,49 @@ syn sync match smlSigSync groupthere smlSig "\" " Define the default highlighting. " Only when an item doesn't have highlighting yet -hi def link smlBraceErr Error -hi def link smlBrackErr Error -hi def link smlParenErr Error +hi def link smlBraceErr Error +hi def link smlBrackErr Error +hi def link smlParenErr Error -hi def link smlCommentErr Error +hi def link smlCommentErr Error -hi def link smlEndErr Error -hi def link smlThenErr Error +hi def link smlEndErr Error +hi def link smlThenErr Error -hi def link smlCharErr Error +hi def link smlCharErr Error -hi def link smlComment Comment +hi def link smlComment Comment -hi def link smlModPath Include -hi def link smlModule Include -hi def link smlModParam1 Include -hi def link smlModType Include -hi def link smlMPRestr3 Include -hi def link smlFullMod Include +hi def link smlModPath Include +hi def link smlModule Include +hi def link smlModParam1 Include +hi def link smlModType Include +hi def link smlMPRestr3 Include +hi def link smlFullMod Include hi def link smlModTypeRestr Include -hi def link smlWith Include -hi def link smlMTDef Include +hi def link smlWith Include +hi def link smlMTDef Include hi def link smlConstructor Constant -hi def link smlModPreRHS Keyword -hi def link smlMPRestr2 Keyword -hi def link smlKeyword Keyword -hi def link smlFunDef Keyword -hi def link smlRefAssign Keyword -hi def link smlKeyChar Keyword -hi def link smlAnyVar Keyword -hi def link smlTopStop Keyword -hi def link smlOperator Keyword - -hi def link smlBoolean Boolean -hi def link smlCharacter Character -hi def link smlNumber Number -hi def link smlReal Float -hi def link smlString String -hi def link smlType Type -hi def link smlTodo Todo -hi def link smlEncl Keyword +hi def link smlModPreRHS Keyword +hi def link smlMPRestr2 Keyword +hi def link smlKeyword Keyword +hi def link smlFunDef Keyword +hi def link smlRefAssign Keyword +hi def link smlKeyChar Keyword +hi def link smlAnyVar Keyword +hi def link smlTopStop Keyword +hi def link smlOperator Keyword + +hi def link smlBoolean Boolean +hi def link smlCharacter Character +hi def link smlNumber Number +hi def link smlReal Float +hi def link smlString String +hi def link smlType Type +hi def link smlTodo Todo +hi def link smlEncl Keyword let b:current_syntax = "sml" diff --git a/syntax/stylus.vim b/syntax/stylus.vim index 9ddb4b82..bcf479c4 100644 --- a/syntax/stylus.vim +++ b/syntax/stylus.vim @@ -3,882 +3,378 @@ if polyglot#init#is_disabled(expand(':p'), 'stylus', 'syntax/stylus.vim') endif " Vim syntax file -" Language: Stylus -" Author: Ilia Loginov -" Created: Jan 5, 2018 - +" Language: CSS3 +" Maintainer: Hsiaoming Yang +" URL: http://lepture.me/work/css3/ +" Created: Dec 14, 2011 +" Modified: Sep 4, 2012 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded if !exists("main_syntax") - if exists("b:current_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") finish endif - let main_syntax = 'stylus' + let main_syntax = 'css' endif -syntax case ignore - -" First of all define indented and not indented lines -syntax match stylusNewLine "^\S\@=" - \ nextgroup=stylusComment,stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusVariable,stylusExplicitVariable,stylusInterpolationSelectors,stylusFunctionName,stylusConditional,stylusOperatorReturn,stylusAtRuleMedia,stylusAtRuleKeyframes,stylusAtRuleNamespace,stylusAtRuleSupports,stylusAtRuleDocument,stylusAtRulePage,stylusAtRuleViewport - -syntax match stylusNewLineIndented "^\s\+" - \ nextgroup=stylusComment,stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusProperty,stylusVariable,stylusExplicitVariable,stylusInterpolation,stylusFunctionName,stylusUnitInt,stylusParenthesised,stylusOperatorReturn,stylusConditional,stylusAtRuleMedia,stylusAtRuleKeyframes,stylusAtRuleKeyframesOffset,stylusAtRuleNamespace,stylusAtRuleSupports,stylusAtRuleDocument,stylusAtRulePageMarginBoxTypes,stylusAtRuleViewport,stylusAtRuleExtends - -" =============================================== -" ENCLOSURES -" =============================================== - -syntax match stylusEnclosure "\(\[\|\]\|{\|}\|(\|)\)" - \ contained - -highlight def link stylusEnclosure SpecialChar - -" =============================================== -" VARIABLES -" =============================================== - -syntax match stylusVariable "\<\(\w\|-\|\$\)*\>" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusOperatorAssignment,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusSubscript,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorVarDefinition,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional,stylusHashDotGetter - \ skipwhite - -syntax match stylusExplicitVariable "\$\(\w\|-\|\$\)*\>" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusOperatorAssignment,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusSubscript,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorVarDefinition,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional,stylusHashDotGetter,stylusOptional - \ skipwhite - -syntax match stylusExplicitVariable "\" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusSubscript,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorVarDefinition,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional,stylusHashDotGetter - \ skipwhite - -highlight def link stylusExplicitVariable Identifier - -" =============================================== -" OPERATORS -" =============================================== - -" Unary -syntax match stylusOperatorUnary "\([-+\!\~]\+\|\\)" - \ contained - \ nextgroup=stylusVariable,stylusExplicitVariable,stylusUnitInt,stylusUnitFloat,stylusParenthesised,stylusPropertyLookup,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorUnary Operator - -" Additive -syntax match stylusOperatorAdditive "[-+]" - \ contained - \ nextgroup=stylusVariable,stylusExplicitVariable,stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusParenthesised,stylusPropertyLookup,stylusColor,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorAdditive Operator - -" Multiplicative -syntax match stylusOperatorMultiplicative "\([/\%]\|\*\{1,2}\)" - \ contained - \ nextgroup=stylusVariable,stylusExplicitVariable,stylusUnitInt,stylusUnitFloat,stylusParenthesised,stylusPropertyLookup,stylusFunctionName - \ skipwhite -highlight def link stylusOperatorMultiplicative Operator - -" Ternary -syntax match stylusOperatorTernary "[:?]" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorTernary Operator - -" Assignment -syntax match stylusOperatorAssignment "[/\*+-:?]\==" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName,stylusHash,stylusAtRuleBlock - \ skipwhite - -highlight def link stylusOperatorAssignment Operator - -" Relational -syntax match stylusOperatorRelational "\(=\{2}\|\\(\s\\)\=\|\!=\|\\|>=\|<=\|>\|<\)" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusVariable,stylusExplicitVariable,stylusParenthesised,stylusPropertyLookup,stylusColor,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorRelational Operator - -" Logical -syntax match stylusOperatorLogical "\(&&\|||\|\\|\\)" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorLogical Operator - -" Existence -syntax match stylusOperatorExistence "\" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorExistence Operator - -" Instance -syntax match stylusOperatorInstance "\" - \ contained - \ skipwhite - -highlight def link stylusOperatorInstance Operator - -" Variable definition -syntax match stylusOperatorVarDefinition "\" - \ contained - \ nextgroup=stylusOperatorLogical,stylusOperatorTernary,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorVarDefinition Operator - -" Return -syntax match stylusOperatorReturn "\" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusOperatorReturn Operator - -" Comma -syntax match stylusComma /,\(\s\=\(\a\w\{-}:\|\('\|"\).\{-}\('\|"\):\)\)\@!/ - \ containedin=ALLBUT,stylusString,stylusComment,stylusHash,stylusAtRuleMediaComma - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -" Range -syntax match stylusOperatorRange "\.\.\.\=" - \ contained - \ nextgroup=stylusUnitInt,stylusVariable,stylusExplicitVariable,stylusFunctionName - -highlight def link stylusOperatorRange Operator - -" =============================================== -" CONDITIONALS -" =============================================== - -syntax match stylusConditional "\<\(if\|else\|unless\|for\)\>" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusConditional Conditional - -" =============================================== -" SPRINTF -" =============================================== - -syntax match stylusSprintfPlaceholder "%s" - \ contained - -highlight def link stylusSprintfPlaceholder Operator - -syntax match stylusSprintfDefinition "%" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -highlight def link stylusSprintfDefinition Operator - -" =============================================== -" SUBSCRIPT -" =============================================== - -syntax region stylusSubscript matchgroup=stylusEnclosure start="\[" end="\]" - \ contained - \ contains=stylusExplicitVariable,stylusVariable,stylusUnitInt,stylusParenthesised,stylusPropertyLookup,stylusFunctionName - \ keepend - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional,stylusOperatorAssignment,stylusHashDotGetter - \ oneline - \ skipwhite - -" =============================================== -" UNITS -" =============================================== - -syntax match stylusUnitInt "[-+]\=\d\+%\=" - \ contained - \ nextgroup=stylusOperatorRange,stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -syntax match stylusUnitInt "\" - \ contained - \ nextgroup=stylusOperatorRange,stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusUnitInt Number - -syntax match stylusUnitFloat "[-+]\=\d\=\.\d\+%\=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusUnitFloat Number - -execute 'syntax match stylusUnitName "\(\<\|\d\@<=\)\(' . join(g:css_units, '\|') . '\)\>" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite' - -highlight def link stylusUnitName Number - -" Resolve 'in' unit name and operator conflict -syntax match stylusOperatorExistence "\s\@<=\" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName - \ skipwhite - -" =============================================== -" BOOLEAN -" =============================================== - -syntax match stylusBoolean "\<\(true\|false\|null\)\>" - \ contained - \ nextgroup=stylusOperatorRelational,stylusOperatorAssignment,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusBoolean Boolean - -" =============================================== -" SELECTORS -" =============================================== - -" HTML or SVG elements -execute 'syn match stylusSelectorElement "\<\(' . join(g:html_elements, '\|') . '\)\(\>\|#\@=\)" - \ contained - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite' - -syn match stylusSelectorElement "\(^\|\s\)\@<=\*\($\|\s\)\@=" - \ contained - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite - -highlight def link stylusSelectorElement Statement - -" CSS Class -syntax region stylusSelectorClass start="\." skip="\w-\@=" end="\(\w\|-+\)\(\W\|$\)\@=" - \ contained - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional,stylusOptional - \ oneline - \ skipwhite - -syntax match stylusSelectorClass "\.{\@=" - \ contained - \ nextgroup=stylusInterpolationSelectors - -highlight def link stylusSelectorClass Identifier - -" CSS Id -syntax region stylusSelectorId start="#" skip="\w-\@=" end="\(\w\|-+\)\(\W\|$\)\@=" - \ contained - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite - -syntax match stylusSelectorId "#{\@=" - \ contained - \ nextgroup=stylusInterpolationSelectors - -highlight def link stylusSelectorId Identifier - -" Attribute selectors -syntax match stylusSelectorAttributeOperator "\(=\|\~=\||=\|\^=\|\$=\|\*=\)" - \ contained - -highlight def link stylusSelectorAttributeOperator Operator - -syntax region stylusSelectorAttribute matchgroup=stylusEnclosure start="\[" skip="{.\{-}}" end="\]" - \ contained - \ contains=stylusSelectorAttributeOperator,stylusInterpolation - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite - -highlight def link stylusSelectorAttribute Type - -" Parent reference -syntax match stylusSelectorReference "\(&\|\~/\|\(\.\./\)\+\|/\)" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ skipwhite - -highlight def link stylusSelectorReference Statement - -" Partial reference -syntax region stylusSelectorPartialReference matchgroup=stylusSelectorReference start="\^\[\@=" skip="{.\{-}}" matchgroup=NONE end="\]" - \ contained - \ contains=stylusEnclosure,stylusUnitInt,stylusInterpolation - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite - -syntax region stylusSelectorClass start="\(&\|\~/\|\(\.\./\)\+\|/\)" skip="\w[-()]\@=" end="\(\w\|(\|)\)\(\W\|$\)\@=" - \ contained - \ contains=stylusSelectorReference - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusOptional - \ oneline - \ skipwhite - -" CSS pseudo classes and elements -execute 'syntax match stylusSelectorPseudo ":\(' . join(g:css_pseudo, '\|') . '\)-\@!" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite' - -syntax match stylusSelectorPseudo ":\(\(first\|last\|only\)-\(child\|of-type\)\)" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite - -syntax match stylusSelectorPseudo ":not(.\{-})" - \ contained - \ contains=stylusSelectorElement,stylusEnclosure,stylusInterpolationSelectors - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite - -syntax match stylusSelectorPseudo ":lang(.\{-})" - \ contained - \ contains=stylusEnclosure,stylusInterpolationSelectors - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite - -syntax match stylusSelectorPseudo ":\(nth-last-\|nth-\)\(child\|of-type\)(.\{-})" - \ contained - \ contains=stylusUnitInt,stylusEnclosure,stylusInterpolationSelectors - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite - -syntax match stylusSelectorPseudo /::\=\(first-\(line\|letter\)\|before\|after\|selection\|placeholder\)/ - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusSelectorPseudo,stylusOptional - \ skipwhite - -highlight def link stylusSelectorPseudo Define - -" CSS Selector operators -syntax match stylusSelectorCombinator "[>\~+|,]" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusExplicitVariable - \ skipwhite - -highlight def link stylusSelectorCombinator Operator - -" =============================================== -" PROPERTIES -" =============================================== - -execute 'syntax match stylusProperty "\<\(' . join(g:css_single_props, '\|') . '\)\>-\@!:\=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite' - -execute 'syntax match stylusProperty "\<\(' . join(g:css_multi_props, '\|') . '\)\>-\@!:\=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite' - -execute 'syntax match stylusProperty "\<\(' . join(g:svg_props, '\|') . '\)\>-\@!:\=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite' - -syntax match stylusProperty "\(-webkit-\|-moz-\|-o-\|-ms-\|-khtml-\)\(\w\|-\)*:\=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -highlight def link stylusProperty Type - -" =============================================== -" PROPERTY LOOKUP -" =============================================== - -execute 'syntax match stylusPropertyLookup "@\(' . join(g:css_props, '\|') . '\)\>-\@!" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite' - -execute 'syntax match stylusPropertyLookup "@\(' . join(g:svg_props, '\|') . '\)\>-\@!" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite' - -syntax match stylusPropertyLookup "@\(-webkit-\|-moz-\|-o-\|-ms-\|-khtml-\)\(\w\|-\)*" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusPropertyLookup Type - -" =============================================== -" VALUES -" =============================================== - -execute 'syntax match stylusValues "\<\(' . join(g:css_values, '\|') . '\)\>-\@!" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName - \ skipwhite' - -execute 'syntax match stylusValues "\<\(' . join(g:css_animatable_props, '\|') . '\)\>-\@!" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName - \ skipwhite' - -highlight def link stylusValues PreCondit - -" =============================================== -" COLORS -" =============================================== - -" Named -execute 'syntax match stylusColor "\<\(' . join(g:css_colors, '\|') . '\)\>-\@!" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusOperatorAdditive,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite' - -syntax match stylusColor "\" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusOperatorAdditive,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -" Hexadecimal -syntax match stylusColor "#\x\{3,6\}\>" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusOperatorAdditive,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -highlight stylusColor term=underline ctermfg=133 guifg=#b169b2 - -" =============================================== -" FONT -" =============================================== - -" Highlight generic font families -syntax match stylusFont "\<\(serif\|sans-serif\|monospace\)\>" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite - -highlight def link stylusFont Directory - -" =============================================== -" Explicitly point out that the word before assignment operator is a variable -syntax match stylusVariable "\<\(\w\|-\)*\(\s\=[:?]\==[^=]\)\@=" - \ contained - \ nextgroup=stylusOperatorAssignment - \ skipwhite -" =============================================== - -" =============================================== -" IMPORTANT -" =============================================== - -syntax match stylusImportant "!important" - \ contained - -highlight def link stylusImportant Special - -" =============================================== -" INTERPOLATION -" =============================================== - -" Prepend is always a property -syntax match stylusProperty "\(\w\|-\)\+{\@=" - \ contained - \ nextgroup=stylusInterpolationProperties - -syntax region stylusInterpolation matchgroup=stylusEnclosure start="{" end="}" - \ contained - \ contains=stylusVariable,stylusExplicitVariable,stylusOperatorUnary,stylusUnitInt,stylusUnitFloat,stylusParenthesised,stylusConditional,stylusFunctionName - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationSelectorsTail,stylusInterpolationPropertiesTail,stylusFunctionName - \ oneline - \ skipwhite - -syntax region stylusInterpolationSelectors matchgroup=stylusEnclosure start="{" end="}" - \ contained - \ contains=stylusVariable,stylusExplicitVariable,stylusOperatorUnary,stylusUnitInt,stylusUnitFloat,stylusParenthesised,stylusConditional,stylusFunctionName - \ keepend - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectorsTail - \ oneline - \ skipwhite - -syntax region stylusInterpolationProperties matchgroup=stylusEnclosure start="{" end="}" - \ contained - \ contains=stylusVariable,stylusExplicitVariable,stylusOperatorUnary,stylusUnitInt,stylusUnitFloat,stylusParenthesised,stylusConditional,stylusFunctionName - \ keepend - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusProperty,stylusInterpolationPropertiesTail,stylusFunctionName - \ oneline - \ skipwhite - -syntax match stylusInterpolationPropertiesTail "}\@<=\(\w\|-\)\+" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusProperty,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -highlight def link stylusInterpolationPropertiesTail Type - -" Tail is a selector by default -syntax match stylusInterpolationSelectorsTail "}\@<=\(\w\|-\)\+" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors - \ skipwhite - -highlight def link stylusInterpolationSelectorsTail Identifier - -" Tail is a property if followed by anything -syntax match stylusInterpolationPropertiesTail "}\@<=\(\w\|-\)\+:\=\s\S\@=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusProperty,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -" Tail is a selector if followed by .#[]$~^& -syntax match stylusInterpolationSelectorsTail "}\@<=\(\w\|-\)\+:\=\s[\.#\[~^&+|,>]\@=" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors - \ skipwhite - -" Tail is a property if followed by float number -syntax match stylusInterpolationPropertiesTail "}\@<=\(\w\|-\)\+:\=\s\(\.\d\)\@=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusProperty,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -" Tail is a property if followed by hex color -syntax match stylusInterpolationPropertiesTail "}\@<=\(\w\|-\)\+:\=\s\(#\x\{3,6}\)\@=" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusProperty,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -execute 'syntax match stylusInterpolationSelectorsTail "}\@<=\(\w\|-\)\+:\=\s\(' . join(g:html_elements, '\|') . '\)\@=" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors - \ skipwhite' - -" =============================================== -" MIXINS & FUNCTIONS -" =============================================== - -syntax match stylusFunctionBlock "+" - \ contained - -highlight def link stylusFunctionBlock Operator - -syntax match stylusFunctionRest "\w\@<=\.\.\." - \ contained - -highlight def link stylusFunctionRest Operator - -syntax match stylusFunctionName "\(\<\|+\)\(\w\|\$\)\(-\|\w\|\$\)\{-}(\@=" - \ contained - \ contains=stylusFunctionBlock - \ nextgroup=stylusFunctionProps - -syntax match stylusFunctionName "@\{-}(\@=" - \ contained - \ contains=stylusFunctionBlock - \ nextgroup=stylusFunctionProps - -highlight def link stylusFunctionName Function - -syntax region stylusFunctionProps matchgroup=stylusEnclosure start="\S\@<=(" end=")" - \ contained - \ contains=stylusOperatorUnary,stylusVariable,stylusExplicitVariable,stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusColor,stylusFunctionName,stylusFunctionRest,stylusValues - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusSubscript,stylusConditional,stylusOperatorRelational - \ skipwhite - - -" =============================================== -" PARENTHESISED EXPRESSIONS -" =============================================== - -syntax region stylusParenthesised matchgroup=stylusEnclosure start="\W\@<=(" skip=/["'].\{-}["']/ end=")" - \ contained - \ contains=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ keepend - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusUnitName,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ oneline - \ skipwhite - -" Resolve '%' unit name and operator conflict -syntax match stylusUnitName ")\@<=%" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional - \ skipwhite -" =============================================== -" STRINGS -" =============================================== - -syntax region stylusString start=/\('\|"\)/ end=/\('\|"\)/ - \ containedin=ALLBUT,stylusComment,stylusHash,stylusHashStringKey - \ contains=stylusSprintfPlaceholder - \ keepend - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusOperatorAdditive,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorTernary,stylusSprintfDefinition,stylusImportant,stylusFunctionName,stylusConditional - \ oneline - \ skipwhite - -highlight def link stylusString String - -" =============================================== -" HASHES -" =============================================== - -syntax match stylusHashKey "\a\w\{-}:" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName,stylusHash,stylusString - \ skipwhite - -highlight def link stylusHashKey NonText - -syntax region stylusHashStringKey start=/\('\|"\)/ end=/\('\|"\):/ - \ contained - \ keepend - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusBoolean,stylusFunctionName,stylusHash,stylusString - \ oneline - \ skipwhite - -highlight def link stylusHashStringKey String - -syntax match stylusHashDotGetter "\S\@<=\." - \ contained - \ nextgroup=stylusHashIdent - -highlight def link stylusHashDotGetter Operator - -syntax match stylusHashComma "," - \ contained - \ nextgroup=stylusHashKey,stylusHashStringKey - \ skipwhite - -syntax match stylusHashIdent "\<\(\w\|-\|\$\)*\>" - \ contained - \ nextgroup=stylusColor,stylusUnitInt,stylusUnitFloat,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusOperatorAssignment,stylusPropertyLookup,stylusParenthesised,stylusOperatorAdditive,stylusOperatorMultiplicative,stylusSubscript,stylusOperatorRelational,stylusOperatorLogical,stylusOperatorExistence,stylusOperatorInstance,stylusOperatorVarDefinition,stylusOperatorTernary,stylusImportant,stylusFunctionName,stylusConditional,stylusHashDotGetter - \ skipwhite - -highlight def link stylusHashIdent NonText - -syntax region stylusHash matchgroup=stylusEnclosure start="{" end="}" - \ contained - \ contains=stylusHashKey,stylusHashStringKey,stylusHash,stylusHashComma - \ skipwhite - -" =============================================== -" @ RULES -" =============================================== - -syntax match stylusAtRuleImport "@\(import\|require\)\>" - \ containedin=ALLBUT,stylusString,stylusComment - \ nextgroup=stylusFunctionName,stylusVariable,stylusExplicitVariable - \ skipwhite - -highlight def link stylusAtRuleImport Macro - -syntax match stylusAtRuleMedia "@media\>" - \ contained - \ nextgroup=stylusAtRuleMediaType,stylusAtRuleMediaFeatureExpression - \ skipwhite - -highlight def link stylusAtRuleMedia Macro - -syntax match stylusAtRuleMediaType "\<\(all\|print\|screen\|speech\)\>" - \ contained - \ nextgroup=stylusAtRuleMediaType,stylusAtRuleMediaFeatureExpression,stylusAtRuleMediaLogical - \ skipwhite - -highlight def link stylusAtRuleMediaType Macro - -syntax match stylusAtRuleMediaLogical "\<\(and\|not\|only\)\>" - \ contained - \ nextgroup=stylusAtRuleMediaType,stylusAtRuleMediaFeatureExpression,stylusAtRuleMediaLogical - \ skipwhite - -highlight def link stylusAtRuleMediaLogical Operator - -syntax region stylusAtRuleMediaFeatureExpression matchgroup=stylusEnclosure start="(" end=")" - \ contained - \ contains=stylusAtRuleMediaFeature,stylusInterpolationProperties,stylusInterpolationPropertiesTail - \ nextgroup=stylusAtRuleMediaComma,stylusAtRuleMediaLogical - \ oneline - \ skipwhite - -execute 'syntax match stylusAtRuleMediaFeature "\(min-\|max-\)\=\(' . join(g:css_media_features, '\|') . '\)\>:" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite' - -syntax match stylusAtRuleMediaFeature "\(\w\|-\)\+{\@=" - \ contained - \ nextgroup=stylusInterpolationProperties - -syntax match stylusAtRuleMediaFeature "}\@<=:" - \ contained - \ nextgroup=stylusUnitInt,stylusUnitFloat,stylusColor,stylusValues,stylusFont,stylusVariable,stylusExplicitVariable,stylusPropertyLookup,stylusParenthesised,stylusOperatorUnary,stylusInterpolationProperties,stylusFunctionName - \ skipwhite - -highlight def link stylusAtRuleMediaFeature Type - -syntax match stylusAtRuleMediaComma "," - \ contained - \ nextgroup=stylusAtRuleMediaFeatureExpression - \ skipwhite - -syntax match stylusAtRuleFont "@font-face\>" - \ containedin=ALLBUT,stylusString,stylusComment - -highlight def link stylusAtRuleFont Macro - -syntax match stylusAtRuleKeyframes "@\(-\(o\|webkit\|moz\)-\)\=keyframesi\>" - \ contained - \ nextgroup=stylusAtRuleKeyframesName,stylusInterpolationSelectors - \ skipwhite - -highlight def link stylusAtRuleKeyframes Macro - -syntax match stylusAtRuleKeyframesName "\<\(\w\|-\|\$\)*\>" - \ contained - \ nextgroup=stylusInterpolationSelectors - \ skipwhite - -highlight def link stylusAtRuleKeyframesName Identifier - -syntax match stylusAtRuleKeyframesOffset "\d\{1,3}%" - \ contained - -syntax match stylusAtRuleKeyframesOffset "\<\(from\|to\)\>" - \ contained - -highlight def link stylusAtRuleKeyframesOffset Macro - -syntax match stylusAtRuleNamespace "@namespace\>" - \ contained - \ nextgroup=stylusAtRuleNamespacePrefix,stylusAtRuleNamespaceUrl - \ skipwhite - -highlight def link stylusAtRuleNamespace Macro - -syntax match stylusAtRuleNamespacePrefix "\<\(\w\|-\|\$\)*\>" - \ contained - \ nextgroup=stylusAtRuleNamespaceUrl - \ skipwhite - -highlight def link stylusAtRuleNamespacePrefix Macro - -syntax match stylusAtRuleNamespaceUrl "\" - \ contained - \ nextgroup=stylusAtRuleSupportsLogic,stylusAtRuleSupportsDeclaration - \ skipwhite - -highlight def link stylusAtRuleSupports Macro - -syntax region stylusAtRuleSupportsDeclaration matchgroup=stylusEnclosure start="(" end=")" - \ contained - \ contains=stylusProperty,stylusAtRuleSupportsLogic,stylusAtRuleSupportsDeclaration - \ nextgroup=stylusAtRuleSupportsLogic,stylusAtRuleSupportsDeclaration - \ oneline - \ skipwhite - -syntax match stylusAtRuleSupportsLogic "\<\(and\|not\|or\)\>" - \ contained - \ nextgroup=stylusAtRuleSupportsLogic,stylusAtRuleSupportsDeclaration - \ skipwhite - -highlight def link stylusAtRuleSupportsLogic Operator - -syntax match stylusAtRuleDocument "@document\>" - \ contained - \ nextgroup=stylusAtRuleDocumentFunc - \ skipwhite - -highlight def link stylusAtRuleDocument Macro - -syntax match stylusAtRuleDocumentFunc "\<\(url\|url-prefix\|domain\|regexp\)(\@=" - \ contained - \ nextgroup=stylusAtRuleNamespaceUrlAdress - -highlight def link stylusAtRuleDocumentFunc Function - -syntax match stylusAtRulePage "@page\>" - \ contained - \ nextgroup=stylusAtRulePagePseudo - \ skipwhite +syn case ignore +syn region cssString start='"' end='"' contained +syn region cssString start="'" end="'" contained + +" HTML4 tags +syn keyword cssTagName abbr acronym address applet area base a b +syn keyword cssTagName basefont bdo big blockquote body button br +syn keyword cssTagName caption cite code col colgroup dd del +syn keyword cssTagName dfn dir div dl dt em fieldset form frame +syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i +syn keyword cssTagName iframe img input ins isindex kbd label legend li +syn keyword cssTagName link map menu meta noframes noscript ol optgroup +syn keyword cssTagName option p param pre q s samp script select +syn keyword cssTagName span strike strong style sub sup tbody td +syn keyword cssTagName textarea tfoot th thead title tr tt ul u var +syn match cssTagName "\*" +syn match cssTagName /\/ +syn match cssTagName /\/ +syn match cssTagName /\/ +" HTML5 tags +syn keyword cssTagName article aside audio bb canvas command datagrid +syn keyword cssTagName datalist details dialog embed figure footer figcaption +syn keyword cssTagName header hgroup keygen mark meter nav output +syn keyword cssTagName progress time rt rp section time video +syn match cssTagName /\/ +" class select +syn match cssSelector /\.[A-Za-z][A-Za-z0-9_-]\+/ +" id select +syn match cssSelector /#[A-Za-z][A-Za-z0-9_-]\+/ +syn region cssSelector start='\[' end='\]' contains=cssString + +syn region cssDefineBlock start="{" end="}" transparent contains=TOP + +syn keyword cssCommonVal inherit initial auto both normal hidden none medium contained + + +" Comment +syn keyword cssTodo FIXME TODO contained +syn region cssComment start="/\*" end="\*/" contains=cssTodo +syn match cssImportant "!\s*important\>" contained + +syn match cssValueInteger "[-+]\=\d\+" contained +syn match cssValueNumber "[-+]\=\d\+\(\.\d*\)\=" +syn match cssValueLength "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|vh\|vw\|vm\|fr\|gr\)" contained +syn match cssValueAngle "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\|turn\)" contained +syn match cssValueTime "+\=\d\+\(\.\d*\)\=\(ms\|s\)" contained +syn match cssValueFrequency "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)" contained + + +" Properties http://www.w3.org/community/webed/wiki/CSS/Properties +" background http://www.w3.org/TR/css3-background/ +syn match cssBackgroundProp /\(background-\(color\|image\|repeat\|attachment\|position\)\|background\)/ contained +syn match cssBackgroundProp /background-\(origin\|\(repeat\|position\)-[xy]\|clip\|size\)/ contained +syn match cssBackgroundProp /object-\(fit\|position\)/ contained +" http://www.evotech.net/blog/2010/02/css3-properties-values-browser-support/ +syn keyword cssBackgroundVal tb lr rl snap cover contain widthLength heightLength contained +syn match cssBackgroundVal /\(scale-down\|from-image\)/ contained +syn match cssBackgroundVal /repeat-[xy]/ contained +syn match cssBackgroundVal /no-repeat/ contained +syn keyword cssBackgroundVal circle ellipse to at contained +syn match cssBackgroundVal /\(closest\|farthest\)-\(side\|corner\)/ contained + +syn region cssFuncVal start="\(url\|calc\|min\|max\|counter\|cycle(\)" end=")" oneline contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn region cssFuncVal start="\(linear\|radial\|repeating-linear\|repeating-radial\)-gradient(" end=")" oneline contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssVisualProp,cssColorVal + +syn match cssBorderProp /\(border-\(color\|style\|width\|radius\)\|border\)/ contained +syn match cssBorderProp /border-\(image-\(source\|slice\|width\|outset\|repeat\)\|image\)/ contained +syn match cssBorderProp /border-\(\(top\|right\|bottom\|left\)-\(color\|style\|width\)\|\(top\|right\|bottom\|left\)\)/ contained +syn match cssBorderProp /border-\(top\|bottom\)-\(left\|right\)-radius/ contained +syn keyword cssBorderVal dotted dashed solid double groove ridge inset outset contained +syn match cssBorderVal /\/ contained +syn match cssBorderVal /\/ contained +syn match cssBorderVal /\/ contained + +" Font +syn match cssFontProp /\(font-\(family\|style\|variant\|weight\|size-adjust\|size\|stretch\)\|font\)/ contained +syn match cssFontVal /\(sans-serif\|small-caps\)/ contained +syn match cssFontVal /\/ contained +syn keyword cssFontVal cursive fantasy monospace italic oblique serif contained +syn keyword cssFontVal bold bolder lighter larger smaller contained +syn keyword cssFontVal icon narrower wider contained + +" Color +syn match cssColorVal /transparent/ contained +syn match cssColorVal "#[0-9A-Fa-f]\{3\}\>" contained +syn match cssColorVal "#[0-9A-Fa-f]\{6\}\>" contained +syn match cssFuncVal /rgb(\(\d\{1,3\}\s*,\s*\)\{2\}\d\{1,3\})/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /rgba(\(\d\{1,3\}\s*,\s*\)\{3\}\(1\|0\(\.\d\+\)\?\))/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /hsl(\d\{1,3\}\s*,\s*\(100\|\d\{1,2\}\(\.\d\+\)\?\)%\s*,\s*\(100\|\d\{1,2\}\(\.\d\+\)\?\)%)/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /hsla(\d\{1,3\}\s*,\s*\(\(100\|\d\{1,2\}\(\.\d\+\)\?\)%\s*,\s*\)\{2\}\(1\|0\(\.\d\+\)\?\))/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn keyword cssColorVal aliceblue antiquewhite aqua aquamarine azure contained +syn keyword cssColorVal beige bisque black blanchedalmond blue blueviolet brown burlywood contained +syn keyword cssColorVal cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan contained +syn match cssColorVal /dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)/ contained +syn match cssColorVal /dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)/ contained +syn match cssColorVal /darkslate\(blue\|gray\|grey\)/ contained +syn match cssColorVal /dark\(turquoise\|violet\)/ contained +syn keyword cssColorVal deeppink deepskyblue dimgray dimgrey dodgerblue firebrick contained +syn keyword cssColorVal floralwhite forestgreen fuchsia gainsboro ghostwhite gold contained +syn keyword cssColorVal goldenrod gray green greenyellow grey honeydew hotpink contained +syn keyword cssColorVal indianred indigo ivory khaki lavender lavenderblush lawngreen contained +syn keyword cssColorVal lemonchiffon lime limegreen linen magenta maroon contained +syn match cssColorVal /light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)/ contained +syn match cssColorVal /light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)/ contained +syn match cssColorVal /light\(slategray\|slategrey\|steelblue\)/ contained +syn match cssColorVal /medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)/ contained +syn match cssColorVal /medium\(slateblue\|springgreen\|turquoise\|violetred\)/ contained +syn keyword cssColorVal midnightblue mintcream mistyrose moccasin navajowhite contained +syn keyword cssColorVal navy oldlace olive olivedrab orange orangered orchid contained +syn match cssColorVal /pale\(goldenrod\|green\|turquoise\|violetred\)/ contained +syn keyword cssColorVal papayawhip peachpuff peru pink plum powderblue purple contained +syn keyword cssColorVal red rosybrown royalblue saddlebrown salmon sandybrown contained +syn keyword cssColorVal seagreen seashell sienna silver skyblue slateblue contained +syn keyword cssColorVal slategray slategrey snow springgreen steelblue tan contained +syn keyword cssColorVal teal thistle tomato turquoise violet wheat contained +syn keyword cssColorVal whitesmoke yellow yellowgreen contained +syn match cssColorVal "\" contained +syn keyword cssColorProp color opaticy contained +syn match cssColorProp /color-profile/ contained + +" Box +syn match cssBoxProp /\(\(margin\|padding\)-\(top\|right\|bottom\|left\)\|\(margin\|padding\)\)/ contained +syn match cssBoxProp /\(min\|max\)-\(width\|height\)/ contained +syn match cssBoxProp /box-\(align\|decoration-break\|direction\|flex-group\|flex\|lines\)/ contained +syn match cssBoxProp /box-\(ordinal-group\|orient\|pack\|shadow\|sizing\)/ contained +syn match cssBoxProp /\(outline-\(color\|offset\|style\|width\)\|outline\)/ contained +syn keyword cssBoxProp width height contained + +" Text +syn match cssTextProp /text-\(align-last\|align\|decoration\|emphasis\|height\|indent\|justify\|outline\|shadow\|transform\|wrap\|overflow\)\|text/ contained +syn match cssTextProp /\(line-stacking-\(ruby\|shift\|strategy\)\|line-stacking\|line-height\)/ contained +syn match cssTextProp /vertical-align/ contained +syn match cssTextProp /letter-spacing/ contained +syn match cssTextProp /user-select/ contained +syn match cssTextProp /white-\(space-collapse\|space\)/ contained +syn match cssTextProp /word-\(break\|spacing\|wrap\)/ contained +syn match cssTextProp "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal /text-\(top\|bottom\)/ contained +syn keyword cssTextVal uppercase lowercase ellipsis middle contained + +" List +syn match cssListProp /\(list-style-\(type\|image\|position\)\|list-style\)/ contained +syn keyword cssListVal armenian circle disc georgian hebrew square contained +syn match cssListVal /cjk-ideographic/ contained +syn match cssListVal /\(decimal-leading-zero\|decimal\)/ contained +syn match cssListVal /\(\(hiragana\|katakana\)-iroha\|\(hiragana\|katakana\)\)/ contained +syn match cssListVal /\(lower\|upper\)-\(alpha\|latin\|roman\)/ contained +syn match cssListVal /lower-greek/ contained + +" Visual formatting +syn keyword cssVisualProp display position top right bottom left float clear clip contained +syn keyword cssVisualProp zoom visibility cursor direction outline resize contained +syn keyword cssVisualProp opacity contained +syn match cssVisualProp /z-index/ contained +syn match cssVisualProp /\(overflow-\(style\|[xy]\)\|overflow\)/ contained +syn keyword cssVisualVal inline block compact contained +syn match cssVisualVal '\' contained +syn match cssVisualVal /\(inline-\(block\|table\)\|list-item\|run-in\)/ contained +syn match cssVisualVal /table-\(row-group\|header-group\|footer-group\|row\|column-group\|column\|cell\|caption\)/ contained +syn match cssVisualVal /\-\(base-group\|text-group\|base\|text\)/ contained +syn keyword cssVisualVal static relative absolute fixed contained +syn keyword cssVisualVal ltr rtl embed bidi-override pre nowrap contained +syn keyword cssVisualVal crosshair help move pointer progress wait contained +syn keyword cssVisualVal e-resize n-resize ne-resize nw-resize s-resize se-resize sw-resize w-resize contained + +" Table +syn match cssTableProp /border-\(collapse\|spacing\)/ contained +syn match cssTableProp /\(table-layout\|caption-side\|empty-cells\)/ contained + +" Generated content +syn match cssCommonProp /counter-\(reset\|increment\)/ contained +syn keyword cssCommonProp content quotes contained + +" Print +syn match cssPrintProp /break-\(before\|after\|inside\)/ +syn match cssPrintProp /\(page-break-\(before\|after\|inside\)\|page-policy\)/ +syn keyword cssPrintProp orphans windows + +" special keywords +syn match cssSpecialProp /-\(webkit\|moz\|ms\|o\)-/ +syn match cssRuleProp /@\(media\|font-face\|charset\|import\|page\|namespace\)/ +" http://www.w3.org/TR/selectors/ +syn match cssPseudo /:\(link\|visited\|active\|hover\|focus\|before\|after\)/ +syn match cssPseudo /:\(target\|lang\|enabled\|disabled\|checked\|indeterminate\)/ +syn match cssPseudo /:\(root\|\(first\|last\|only\)-\(child\|of-type\)\|empty\)/ +syn match cssPseudo /:\(nth-last-\|nth-\)\(child\|of-type\)(\<\S\+\>)/ +syn match cssPseudo /:not(\<\S*\>)/ +syn match cssPseudo /:first-\(line\|letter\)/ +syn match cssPseudo /::\(first-\(line\|letter\)\|before\|after\|selection\)/ + +" CSS3 Advanced http://meiert.com/en/indices/css-properties/ +syn keyword cssAdvancedProp appearance azimuth binding bleed columns crop hyphens icon +syn keyword cssAdvancedProp phonemes resize richness size volumne +syn match cssAdvancedProp /\(animation-\(delay\|direction\|duration\|name\|iteration-count\|play-state\|timing-function\)\|animation\)/ +syn match cssAdvancedProp /alignment-\(adjust\|baseline\)/ +syn match cssAdvancedProp /\(backface-visibility\baseline-shift\)/ +syn match cssAdvancedProp /bookmark-\(label\|level\|state\|target\)/ +syn match cssAdvancedProp /column-\(count\|fill\|gap\|rule-\(color\|style\|width\)\|rule\|span\|width\)/ +syn match cssAdvancedProp /\(cue-\(after\|before\)\|cue\)/ +syn match cssAdvancedProp /dominant-baseline/ +syn match cssAdvancedProp /drop-initial-\(size\|value\|\(after\|before\)-\(adjust\|align\)\)/ +syn match cssAdvancedProp /\(fit-position\|fit\)/ +syn match cssAdvancedProp /\(float-offset\|hanging-punctuation\)/ +syn match cssAdvancedProp /grid-\(columns\|rows\)/ +syn match cssAdvancedProp /hyphenate-\(after\|before\|character\|lines\|resource\)/ +syn match cssAdvancedProp /image-\(orientation\|rendering\|resolution\)/ +syn match cssAdvancedProp /inline-box-align/ +syn match cssAdvancedProp /\(mark-\(after\|before\)\|mark\|marks\)/ +syn match cssAdvancedProp /marquee-\(direction\|loop\|play-count\|speed\|style\)/ +syn match cssAdvancedProp /move-to/ +syn match cssAdvancedProp /nav-\(down\|index\|left\|right\|up\)/ +syn match cssAdvancedProp /\(pause-\(after\|before\)\|pause\)/ +syn match cssAdvancedProp /\(perspective-origin\|perspective\)/ +syn match cssAdvancedProp /\(pitch-range\|pitch\)/ +syn match cssAdvancedProp /presentation-level/ +syn match cssAdvancedProp /punctuation-trim/ +syn match cssAdvancedProp /rendering-intent/ +syn match cssAdvancedProp /pointer-events/ +syn match cssAdvancedProp /\(rest-\(after\|before\)\|rest\)/ +syn match cssAdvancedProp /\(rotation-point\|rotation\)/ +syn match cssAdvancedProp /ruby-\(align\|overhang\|position\|span\)/ +syn match cssAdvancedProp /\(target-\(name\|new\|position\)\|target\)/ +syn match cssAdvancedProp /\(transform-\(origin\|style\)\|transform\)/ +syn match cssAdvancedProp /\(transition-\(delay\|duration\|property\|timing-function\)\|transition\)/ +syn match cssAdvancedProp /voice-\(balance\|duration\|family\|pitch-range\|pitch\|rate\|stress\|volume\)/ + +syn match cssAdvancedVal /\(ease-\(in\|out\|in-out\)\|ease\)/ contained + +" CSS3 Advanced value +"syn match cssAdvancedVal + + +if main_syntax == "css" + syn sync minlines=10 +endif -highlight def link stylusAtRulePage Macro +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_css_syn_inits") + if version < 508 + let did_css_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif -syntax match stylusAtRulePagePseudo ":\(left\|right\|first\|blank\)\>" - \ contained + HiLink cssString String + HiLink cssComment Comment + HiLink cssTagName Statement + HiLink cssSelector Function + HiLink cssBackgroundProp StorageClass + HiLink cssTableProp StorageClass + HiLink cssBorderProp StorageClass + HiLink cssFontProp StorageClass + HiLink cssColorProp StorageClass + HiLink cssBoxProp StorageClass + HiLink cssTextProp StorageClass + HiLink cssListProp StorageClass + HiLink cssVisualProp StorageClass + HiLink cssAdvancedProp StorageClass + HiLink cssCommonProp StorageClass + HiLink cssSpecialProp Special + HiLink cssImportant Special + HiLink cssRuleProp PreProc + HiLink cssPseudo PreProc + + HiLink cssColorVal Constant + HiLink cssCommonVal Type + HiLink cssFontVal Type + HiLink cssListVal Type + HiLink cssTextVal Type + HiLink cssVisualVal Type + HiLink cssBorderVal Type + HiLink cssBackgroundVal Type + HiLink cssFuncVal Function + HiLink cssAdvancedVal Function + + HiLink cssValueLength Number + HiLink cssValueInteger Number + HiLink cssValueNumber Number + HiLink cssValueAngle Number + HiLink cssValueTime Number + HiLink cssValueFrequency Number + delcommand HiLink +endif -highlight def link stylusAtRulePagePseudo Macro +" let b:current_syntax = "css" +" +if main_syntax == 'css' + unlet main_syntax +endif -syntax match stylusAtRulePageMarginBoxTypes "@\(top-left-corner\|top-left\|top-center\|top-right\|top-right-corner\|bottom-left-corner\|bottom-left\|bottom-center\|bottom-right\|bottom-right-corner\|left-top\|left-middle\|left-bottom\|right-top\|right-middle\|right-bottom\)\>" - \ contained +" Vim syntax file +" Language: Stylus +" Maintainer: Marc Harter +" Filenames: *.styl, *.stylus +" Based On: Tim Pope (sass.vim) -highlight def link stylusAtRulePageMarginBoxTypes Macro +syn case ignore -syntax match stylusAtRuleViewport "@viewport\>" - \ contained - \ skipwhite +syn cluster stylusCssSelectors contains=cssTagName,cssSelector,cssPseudo +syn cluster stylusCssValues contains=cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssColorVal,cssCommonVal,cssFontVal,cssListVal,cssTextVal,cssVisualVal,cssBorderVal,cssBackgroundVal,cssFuncVal,cssAdvancedVal +syn cluster stylusCssProperties contains=cssBackgroundProp,cssTableProp,cssBorderProp,cssFontProp,cssColorProp,cssBoxProp,cssTextProp,cssListProp,cssVisualProp,cssAdvancedProp,cssCommonProp,cssSpecialProp -highlight def link stylusAtRuleViewport Macro +syn match stylusVariable "$\?[[:alnum:]_-]\+" +syn match stylusVariableAssignment "\%([[:alnum:]_-]\+\s*\)\@<==" nextgroup=stylusCssAttribute,stylusVariable skipwhite -syntax match stylusAtRuleBlock "@block\>" - \ contained +syn match stylusProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+:" contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute contained containedin=cssDefineBlock +syn match stylusProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+[ :]\|:[[:alnum:]-]\+\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute +syn match stylusProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute -highlight def link stylusAtRuleBlock Macro +syn match stylusCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@stylusCssValues,cssImportant,stylusFunction,stylusVariable,stylusControl,stylusUserFunction,stylusInterpolation,cssString,stylusComment,cssComment -syntax match stylusAtRuleExtends "@extends\=\>" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusExplicitVariable - \ skipwhite +syn match stylusInterpolation %{[[:alnum:]_-]\+}% -highlight def link stylusAtRuleExtends Macro +syn match stylusFunction "\<\%(red\|green\|blue\|alpha\|dark\|light\)\>(\@=" contained +syn match stylusFunction "\<\%(hue\|saturation\|lightness\|push\|unshift\|typeof\|unit\|match\)\>(\@=" contained +syn match stylusFunction "\<\%(hsla\|hsl\|rgba\|rgb\|lighten\|darken\)\>(\@=" contained +syn match stylusFunction "\<\%(abs\|ceil\|floor\|round\|min\|max\|even\|odd\|sum\|avg\|sin\|cos\|join\)\>(\@=" contained +syn match stylusFunction "\<\%(desaturate\|saturate\|invert\|unquote\|quote\|s\)\>(\@=" contained +syn match stylusFunction "\<\%(operate\|length\|warn\|error\|last\|p\|\)\>(\@=" contained +syn match stylusFunction "\<\%(opposite-position\|image-size\|add-property\)\>(\@=" contained -syntax match stylusOptional "!optional" - \ contained - \ nextgroup=stylusSelectorClass,stylusSelectorId,stylusSelectorCombinator,stylusSelectorElement,stylusSelectorAttribute,stylusSelectorPseudo,stylusSelectorReference,stylusSelectorPartialReference,stylusInterpolationSelectors,stylusExplicitVariable - \ skipwhite +syn keyword stylusVariable null true false arguments +syn keyword stylusControl if else unless for in return -highlight def link stylusOptional Special -" =============================================== -" COMMENTS -" =============================================== +syn match stylusImport "@\%(import\|require\)" nextgroup=stylusImportList +syn match stylusImportList "[^;]\+" contained contains=cssString.*,cssMediaType,cssURL -" Single-line -syntax region stylusComment start="//" end="$" - \ containedin=ALLBUT,stylusString - \ keepend - \ oneline +syn match stylusAmpersand "&" +syn match stylusClass "[[:alnum:]_-]\+" contained +syn match stylusClassChar "\.[[:alnum:]_-]\@=" nextgroup=stylusClass +syn match stylusEscape "^\s*\zs\\" +syn match stylusId "[[:alnum:]_-]\+" contained +syn match stylusIdChar "#[[:alnum:]_-]\@=" nextgroup=stylusId -" Multi-line -syntax region stylusComment start="/\*" end="\*/" - \ containedin=ALLBUT,stylusString - \ keepend +syn region stylusComment start="//" end="$" contains=cssTodo,@Spell fold -highlight def link stylusComment Comment +hi def link stylusComment Comment +hi def link stylusVariable Identifier +hi def link stylusControl PreProc +hi def link stylusFunction Function +hi def link stylusInterpolation Delimiter -" =============================================== +hi def link stylusAmpersand Character +hi def link stylusClass Type +hi def link stylusClassChar Special +hi def link stylusEscape Special +hi def link stylusId Identifier +hi def link stylusIdChar Special let b:current_syntax = "stylus" + +" vim:set sw=2: -- cgit v1.2.3