neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

csscomplete.vim (43252B)


      1 " Vim completion script
      2 " Language: CSS
      3 "           Based on MDN CSS Reference at 2016 Jan <https://developer.mozilla.org/en-US/docs/Web/CSS/Reference>
      4 "           plus CSS Speech Module <http://www.w3.org/TR/css3-speech/>
      5 " Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
      6 " Original Author: Mikolaj Machowski ( mikmach AT wp DOT pl )
      7 " Last Change: 2021 Sep 21
      8 
      9 let s:values = split("all additive-symbols align-content align-items align-self animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size block-size border border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip clip-path color columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width content counter-increment counter-reset cue cue-before cue-after cursor direction display empty-cells fallback filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-start grid-column-end grid-row grid-row-start grid-row-end grid-template grid-template-areas grid-template-rows grid-template-columns height hyphens image-rendering image-resolution image-orientation ime-mode inline-size isolation justify-content left letter-spacing line-break line-height list-style list-style-image list-style-position list-style-type margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin-top marks mask mask-type max-block-size max-height max-inline-size max-width max-zoom min-block-size min-height min-inline-size min-width min-zoom mix-blend-mode negative object-fit object-position offset-block-end offset-block-start offset-inline-end offset-inline-start opacity order orientation orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y pad padding padding-block-end padding-block-start padding-bottom padding-inline-end padding-inline-start padding-left padding-right padding-top page-break-after page-break-before page-break-inside pause-before pause-after pause perspective perspective-origin pointer-events position prefix quotes range resize rest rest-before rest-after right ruby-align ruby-merge ruby-position scroll-behavior scroll-snap-coordinate scroll-snap-destination scroll-snap-points-x scroll-snap-points-y scroll-snap-type scroll-snap-type-x scroll-snap-type-y shape-image-threshold shape-margin shape-outside speak speak-as suffix symbols system table-layout tab-size text-align text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-orientation text-overflow text-rendering text-shadow text-transform text-underline-position top touch-action transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi unicode-range user-zoom vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-rate voice-range voice-stress voice-volume white-space widows width will-change word-break word-spacing word-wrap writing-mode z-index zoom")
     10 
     11 
     12 function! csscomplete#CompleteCSS(findstart, base)
     13 
     14  if a:findstart
     15    " We need whole line to proper checking
     16    let line = getline('.')
     17    let start = col('.') - 1
     18    let compl_begin = col('.') - 2
     19    while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
     20      let start -= 1
     21    endwhile
     22    let b:compl_context = line[0:compl_begin]
     23    return start
     24  endif
     25 
     26  " There are few chars important for context:
     27  " ^ ; : { } /* */
     28  " Where ^ is start of line and /* */ are comment borders
     29  " Depending on their relative position to cursor we will know what should
     30  " be completed. 
     31  " 1. if nearest are ^ or { or ; current word is property
     32  " 2. if : it is value (with exception of pseudo things)
     33  " 3. if } we are outside of css definitions
     34  " 4. for comments ignoring is be the easiest but assume they are the same
     35  "    as 1. 
     36  " 5. if @ complete at-rule
     37  " 6. if ! complete important
     38  if exists("b:compl_context")
     39    let line = getline('.')
     40    let compl_begin = col('.') - 2
     41    let b:after = line[compl_begin:]
     42    let line = b:compl_context
     43    unlet! b:compl_context
     44  else
     45    let line = a:base
     46    let b:after = ''
     47  endif
     48 
     49  let res = []
     50  let res2 = []
     51  let borders = {}
     52 
     53  " Check last occurrence of sequence
     54 
     55  let openbrace  = strridx(line, '{')
     56  let closebrace = strridx(line, '}')
     57  let colon      = strridx(line, ':')
     58  let semicolon  = strridx(line, ';')
     59  let opencomm   = strridx(line, '/*')
     60  let closecomm  = strridx(line, '*/')
     61  let style      = strridx(line, 'style\s*=')
     62  let atrule     = strridx(line, '@')
     63  let exclam     = strridx(line, '!')
     64 
     65  if openbrace > -1
     66    let borders[openbrace] = "openbrace"
     67  endif
     68  if closebrace > -1
     69    let borders[closebrace] = "closebrace"
     70  endif
     71  if colon > -1
     72    let borders[colon] = "colon"
     73  endif
     74  if semicolon > -1
     75    let borders[semicolon] = "semicolon"
     76  endif
     77  if opencomm > -1
     78    let borders[opencomm] = "opencomm"
     79  endif
     80  if closecomm > -1
     81    let borders[closecomm] = "closecomm"
     82  endif
     83  if style > -1
     84    let borders[style] = "style"
     85  endif
     86  if atrule > -1
     87    let borders[atrule] = "atrule"
     88  endif
     89  if exclam > -1
     90    let borders[exclam] = "exclam"
     91  endif
     92 
     93 
     94  if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
     95    " Complete properties
     96 
     97 
     98    let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
     99 
    100    for m in s:values
    101      if m =~? '^'.entered_property
    102        call add(res, m . ':')
    103      elseif m =~? entered_property
    104        call add(res2, m . ':')
    105      endif
    106    endfor
    107 
    108    return res + res2
    109 
    110  elseif borders[max(keys(borders))] == 'colon'
    111    " Get name of property
    112    let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$'))
    113 
    114    let wide_keywords = ["initial", "inherit", "unset"]
    115    let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"]
    116    let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
    117    let border_width_values = ["thin", "thick", "medium"]
    118    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"]
    119    let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"]
    120 
    121    if prop == 'all'
    122      let values = []
    123    elseif prop == 'additive-symbols'
    124      let values = []
    125    elseif prop == 'align-content'
    126      let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"]
    127    elseif prop == 'align-items'
    128      let values = ["flex-start", "flex-end", "center", "baseline", "stretch"]
    129    elseif prop == 'align-self'
    130      let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"]
    131    elseif prop == 'animation'
    132      let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"]
    133    elseif prop == 'animation-delay'
    134      let values = []
    135    elseif prop == 'animation-direction'
    136      let values = ["normal", "reverse", "alternate", "alternate-reverse"]
    137    elseif prop == 'animation-duration'
    138      let values = []
    139    elseif prop == 'animation-fill-mode'
    140      let values = ["none", "forwards", "backwards", "both"]
    141    elseif prop == 'animation-iteration-count'
    142      let values = []
    143    elseif prop == 'animation-name'
    144      let values = []
    145    elseif prop == 'animation-play-state'
    146      let values = ["running", "paused"]
    147    elseif prop == 'animation-timing-function'
    148      let values = timing_functions
    149    elseif prop == 'background-attachment'
    150      let values = ["scroll", "fixed"]
    151    elseif prop == 'background-color'
    152      let values = color_values
    153    elseif prop == 'background-image'
    154      let values = ["url(", "none"]
    155    elseif prop == 'background-position'
    156      let vals = matchstr(line, '.*:\s*\zs.*')
    157      if vals =~ '^\%([a-zA-Z]\+\)\?$'
    158        let values = ["top", "center", "bottom"]
    159      elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
    160        let values = ["left", "center", "right"]
    161      else
    162        return []
    163      endif
    164    elseif prop == 'background-repeat'
    165      let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"]
    166    elseif prop == 'background-size'
    167      let values = ["auto", "contain", "cover"]
    168    elseif prop == 'background'
    169      let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"]
    170    elseif prop =~ 'border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$'
    171      let vals = matchstr(line, '.*:\s*\zs.*')
    172      if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
    173        let values = border_width_values
    174      elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
    175        let values = border_style_values
    176      elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
    177        let values = color_values
    178      else
    179        return []
    180      endif
    181    elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color'
    182      let values = color_values
    183    elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style'
    184      let values = border_style_values
    185    elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width'
    186      let values = border_width_values
    187    elseif prop == 'border-color'
    188      let values = color_values
    189    elseif prop == 'border-style'
    190      let values = border_style_values
    191    elseif prop == 'border-width'
    192      let values = border_width_values
    193    elseif prop == 'bottom'
    194      let values = ["auto"]
    195    elseif prop == 'box-decoration-break'
    196      let values = ["slice", "clone"]
    197    elseif prop == 'box-shadow'
    198      let values = ["inset"]
    199    elseif prop == 'box-sizing'
    200      let values = ["border-box", "content-box"]
    201    elseif prop =~ 'break-\%(before\|after\)'
    202      let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"]
    203    elseif prop == 'break-inside'
    204      let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"]
    205    elseif prop == 'caption-side'
    206      let values = ["top", "bottom"]
    207    elseif prop == 'clear'
    208      let values = ["none", "left", "right", "both"]
    209    elseif prop == 'clip'
    210      let values = ["auto", "rect("]
    211    elseif prop == 'clip-path'
    212      let values = ["fill-box", "stroke-box", "view-box", "none"]
    213    elseif prop == 'color'
    214      let values = color_values
    215    elseif prop == 'columns'
    216      let values = []
    217    elseif prop == 'column-count'
    218      let values = ['auto']
    219    elseif prop == 'column-fill'
    220      let values = ['auto', 'balance']
    221    elseif prop == 'column-rule-color'
    222      let values = color_values
    223    elseif prop == 'column-rule-style'
    224      let values = border_style_values
    225    elseif prop == 'column-rule-width'
    226      let values = border_width_values
    227    elseif prop == 'column-rule'
    228      let vals = matchstr(line, '.*:\s*\zs.*')
    229      if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
    230        let values = border_width_values
    231      elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
    232        let values = border_style_values
    233      elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
    234        let values = color_values
    235      else
    236        return []
    237      endif
    238    elseif prop == 'column-span'
    239      let values = ["none", "all"]
    240    elseif prop == 'column-width'
    241      let values = ["auto"]
    242    elseif prop == 'content'
    243      let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"]
    244    elseif prop =~ 'counter-\%(increment\|reset\)$'
    245      let values = ["none"]
    246    elseif prop =~ 'cue\%(-after\|-before\)\=$'
    247      let values = ["url("]
    248    elseif prop == 'cursor'
    249      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"]
    250    elseif prop == 'direction'
    251      let values = ["ltr", "rtl"]
    252    elseif prop == 'display'
    253      let values = ["inline", "block", "list-item", "inline-list-item", "run-in", "inline-block", "table", "inline-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", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"]
    254    elseif prop == 'elevation'
    255      let values = ["below", "level", "above", "higher", "lower"]
    256    elseif prop == 'empty-cells'
    257      let values = ["show", "hide"]
    258    elseif prop == 'fallback'
    259      let values = list_style_type_values
    260    elseif prop == 'filter'
    261      let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("]
    262    elseif prop == 'flex-basis'
    263      let values = ["auto", "content"]
    264    elseif prop == 'flex-flow'
    265      let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"]
    266    elseif prop == 'flex-grow'
    267      let values = []
    268    elseif prop == 'flex-shrink'
    269      let values = []
    270    elseif prop == 'flex-wrap'
    271      let values = ["nowrap", "wrap", "wrap-reverse"]
    272    elseif prop == 'flex'
    273      let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"]
    274    elseif prop == 'float'
    275      let values = ["left", "right", "none"]
    276    elseif prop == 'font-family'
    277      let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
    278    elseif prop == 'font-feature-settings'
    279      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"']
    280    elseif prop == 'font-kerning'
    281      let values = ["auto", "normal", "none"]
    282    elseif prop == 'font-language-override'
    283      let values = ["normal"]
    284    elseif prop == 'font-size'
    285      let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
    286    elseif prop == 'font-size-adjust'
    287      let values = []
    288    elseif prop == 'font-stretch'
    289      let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"]
    290    elseif prop == 'font-style'
    291      let values = ["normal", "italic", "oblique"]
    292    elseif prop == 'font-synthesis'
    293      let values = ["none", "weight", "style"]
    294    elseif prop == 'font-variant-alternates'
    295      let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("]
    296    elseif prop == 'font-variant-caps'
    297      let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"]
    298    elseif prop == 'font-variant-asian'
    299      let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"]
    300    elseif prop == 'font-variant-ligatures'
    301      let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"]
    302    elseif prop == 'font-variant-numeric'
    303      let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"]
    304    elseif prop == 'font-variant-position'
    305      let values = ["normal", "sub", "super"]
    306    elseif prop == 'font-variant'
    307      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"]
    308    elseif prop == 'font-weight'
    309      let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
    310    elseif prop == 'font'
    311      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", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"]
    312    elseif prop =~ '^\%(height\|width\)$'
    313      let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
    314    elseif prop =~ '^\%(left\|right\)$'
    315      let values = ["auto"]
    316    elseif prop == 'image-rendering'
    317      let values = ["auto", "crisp-edges", "pixelated"]
    318    elseif prop == 'image-orientation'
    319      let values = ["from-image", "flip"]
    320    elseif prop == 'ime-mode'
    321      let values = ["auto", "normal", "active", "inactive", "disabled"]
    322    elseif prop == 'inline-size'
    323      let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
    324    elseif prop == 'isolation'
    325      let values = ["auto", "isolate"]
    326    elseif prop == 'justify-content'
    327      let values = ["flex-start", "flex-end", "center", "space-between", "space-around"]
    328    elseif prop == 'letter-spacing'
    329      let values = ["normal"]
    330    elseif prop == 'line-break'
    331      let values = ["auto", "loose", "normal", "strict"]
    332    elseif prop == 'line-height'
    333      let values = ["normal"]
    334    elseif prop == 'list-style-image'
    335      let values = ["url(", "none"]
    336    elseif prop == 'list-style-position'
    337      let values = ["inside", "outside"]
    338    elseif prop == 'list-style-type'
    339      let values = list_style_type_values
    340    elseif prop == 'list-style'
    341      let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"]
    342    elseif prop == 'margin'
    343      let values = ["auto"]
    344    elseif prop =~ 'margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$'
    345      let values = ["auto"]
    346    elseif prop == 'marks'
    347      let values = ["crop", "cross", "none"]
    348    elseif prop == 'mask'
    349      let values = ["url("]
    350    elseif prop == 'mask-type'
    351      let values = ["luminance", "alpha"]
    352    elseif prop == '\%(max\|min\)-\%(block\|inline\)-size'
    353      let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
    354    elseif prop == '\%(max\|min\)-\%(height\|width\)'
    355      let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
    356    elseif prop == '\%(max\|min\)-zoom'
    357      let values = ["auto"]
    358    elseif prop == 'mix-blend-mode'
    359      let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]
    360    elseif prop == 'opacity'
    361      let values = []
    362    elseif prop == 'orientation'
    363      let values = ["auto", "portrait", "landscape"]
    364    elseif prop == 'orphans'
    365      let values = []
    366    elseif prop == 'outline-offset'
    367      let values = []
    368    elseif prop == 'outline-color'
    369      let values = color_values
    370    elseif prop == 'outline-style'
    371      let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
    372    elseif prop == 'outline-width'
    373      let values = ["thin", "thick", "medium"]
    374    elseif prop == 'outline'
    375      let vals = matchstr(line, '.*:\s*\zs.*')
    376      if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$'
    377        let values = color_values
    378      elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$'
    379        let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
    380      elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
    381        let values = ["thin", "thick", "medium"]
    382      else
    383        return []
    384      endif
    385    elseif prop == 'overflow-wrap'
    386      let values = ["normal", "break-word"]
    387    elseif prop =~ 'overflow\%(-x\|-y\)\='
    388      let values = ["visible", "hidden", "scroll", "auto"]
    389    elseif prop == 'pad'
    390      let values = []
    391    elseif prop == 'padding'
    392      let values = []
    393    elseif prop =~ 'padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$'
    394      let values = []
    395    elseif prop =~ 'page-break-\%(after\|before\)$'
    396      let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"]
    397    elseif prop == 'page-break-inside'
    398      let values = ["auto", "avoid"]
    399    elseif prop =~ 'pause\%(-after\|-before\)\=$'
    400      let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
    401    elseif prop == 'perspective'
    402      let values = ["none"]
    403    elseif prop == 'perspective-origin'
    404      let values = ["top", "bottom", "left", "center", " right"]
    405    elseif prop == 'pointer-events'
    406      let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"]
    407    elseif prop == 'position'
    408      let values = ["static", "relative", "absolute", "fixed", "sticky"]
    409    elseif prop == 'prefix'
    410      let values = []
    411    elseif prop == 'quotes'
    412      let values = ["none"]
    413    elseif prop == 'range'
    414      let values = ["auto", "infinite"]
    415    elseif prop == 'resize'
    416      let values = ["none", "both", "horizontal", "vertical"]
    417    elseif prop =~ 'rest\%(-after\|-before\)\=$'
    418      let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
    419    elseif prop == 'ruby-align'
    420      let values = ["start", "center", "space-between", "space-around"]
    421    elseif prop == 'ruby-merge'
    422      let values = ["separate", "collapse", "auto"]
    423    elseif prop == 'ruby-position'
    424      let values = ["over", "under", "inter-character"]
    425    elseif prop == 'scroll-behavior'
    426      let values = ["auto", "smooth"]
    427    elseif prop == 'scroll-snap-coordinate'
    428      let values = ["none"]
    429    elseif prop == 'scroll-snap-destination'
    430      return []
    431    elseif prop == 'scroll-snap-points-\%(x\|y\)$'
    432      let values = ["none", "repeat("]
    433    elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$'
    434      let values = ["none", "mandatory", "proximity"]
    435    elseif prop == 'shape-image-threshold'
    436      let values = []
    437    elseif prop == 'shape-margin'
    438      let values = []
    439    elseif prop == 'shape-outside'
    440      let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url(']
    441    elseif prop == 'speak'
    442      let values = ["auto", "none", "normal"]
    443    elseif prop == 'speak-as'
    444      let values = ["auto", "normal", "spell-out", "digits"]
    445    elseif prop == 'src'
    446      let values = ["url("]
    447    elseif prop == 'suffix'
    448      let values = []
    449    elseif prop == 'symbols'
    450      let values = []
    451    elseif prop == 'system'
    452      let vals = matchstr(line, '.*:\s*\zs.*')
    453      if vals =~ '^extends'
    454        let values = list_style_type_values
    455      else
    456        let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"]
    457      endif
    458    elseif prop == 'table-layout'
    459      let values = ["auto", "fixed"]
    460    elseif prop == 'tab-size'
    461      let values = []
    462    elseif prop == 'text-align'
    463      let values = ["start", "end", "left", "right", "center", "justify", "match-parent"]
    464    elseif prop == 'text-align-last'
    465      let values = ["auto", "start", "end", "left", "right", "center", "justify"]
    466    elseif prop == 'text-combine-upright'
    467      let values = ["none", "all", "digits"]
    468    elseif prop == 'text-decoration-line'
    469      let values = ["none", "underline", "overline", "line-through", "blink"]
    470    elseif prop == 'text-decoration-color'
    471      let values = color_values
    472    elseif prop == 'text-decoration-style'
    473      let values = ["solid", "double", "dotted", "dashed", "wavy"]
    474    elseif prop == 'text-decoration'
    475      let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values
    476    elseif prop == 'text-emphasis-color'
    477      let values = color_values
    478    elseif prop == 'text-emphasis-position'
    479      let values = ["over", "under", "left", "right"]
    480    elseif prop == 'text-emphasis-style'
    481      let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
    482    elseif prop == 'text-emphasis'
    483      let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
    484    elseif prop == 'text-indent'
    485      let values = ["hanging", "each-line"]
    486    elseif prop == 'text-orientation'
    487      let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"]
    488    elseif prop == 'text-overflow'
    489      let values = ["clip", "ellipsis"]
    490    elseif prop == 'text-rendering'
    491      let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"]
    492    elseif prop == 'text-shadow'
    493      let values = color_values
    494    elseif prop == 'text-transform'
    495      let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"]
    496    elseif prop == 'text-underline-position'
    497      let values = ["auto", "under", "left", "right"]
    498    elseif prop == 'touch-action'
    499      let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"]
    500    elseif prop == 'transform'
    501      let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("]
    502    elseif prop == 'transform-box'
    503      let values = ["border-box", "fill-box", "view-box"]
    504    elseif prop == 'transform-origin'
    505      let values = ["left", "center", "right", "top", "bottom"]
    506    elseif prop == 'transform-style'
    507      let values = ["flat", "preserve-3d"]
    508    elseif prop == 'top'
    509      let values = ["auto"]
    510    elseif prop == 'transition-property'
    511      let values = ["all", "none"] + s:values
    512    elseif prop == 'transition-duration'
    513      let values = []
    514    elseif prop == 'transition-delay'
    515      let values = []
    516    elseif prop == 'transition-timing-function'
    517      let values = timing_functions
    518    elseif prop == 'transition'
    519      let values = ["all", "none"] + s:values + timing_functions
    520    elseif prop == 'unicode-bidi'
    521      let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"]
    522    elseif prop == 'unicode-range'
    523      let values = ["U+"]
    524    elseif prop == 'user-zoom'
    525      let values = ["zoom", "fixed"]
    526    elseif prop == 'vertical-align'
    527      let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"]
    528    elseif prop == 'visibility'
    529      let values = ["visible", "hidden", "collapse"]
    530    elseif prop == 'voice-volume'
    531      let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"]
    532    elseif prop == 'voice-balance'
    533      let values = ["left", "center", "right", "leftwards", "rightwards"]
    534    elseif prop == 'voice-family'
    535      let values = []
    536    elseif prop == 'voice-rate'
    537      let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"]
    538    elseif prop == 'voice-pitch'
    539      let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
    540    elseif prop == 'voice-range'
    541      let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
    542    elseif prop == 'voice-stress'
    543      let values = ["normal", "strong", "moderate", "none", "reduced "]
    544    elseif prop == 'voice-duration'
    545      let values = ["auto"]
    546    elseif prop == 'white-space'
    547      let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
    548    elseif prop == 'widows'
    549      let values = []
    550    elseif prop == 'will-change'
    551      let values = ["auto", "scroll-position", "contents"] + s:values
    552    elseif prop == 'word-break'
    553      let values = ["normal", "break-all", "keep-all"]
    554    elseif prop == 'word-spacing'
    555      let values = ["normal"]
    556    elseif prop == 'word-wrap'
    557      let values = ["normal", "break-word"]
    558    elseif prop == 'writing-mode'
    559      let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"]
    560    elseif prop == 'z-index'
    561      let values = ["auto"]
    562    elseif prop == 'zoom'
    563      let values = ["auto"]
    564    else
    565      " If no property match it is possible we are outside of {} and
    566      " trying to complete pseudo-(class|element)
    567      let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$'))
    568      if stridx('a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,bgsound,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,element,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,main,map,mark,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,pre,progress,q,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr', ','.element.',') > -1
    569        let values = ["active", "any", "checked", "default", "dir(", "disabled", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "focus", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "not(", "nth-child(", "nth-last-child(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "read-only", "read-write", "required", "right", "root", "scope", "target", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"]
    570      else
    571        return []
    572      endif
    573    endif
    574 
    575    let values = wide_keywords + values
    576    " Complete values
    577    let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
    578 
    579    for m in values
    580      if m =~? '^'.entered_value
    581        call add(res, m)
    582      elseif m =~? entered_value
    583        call add(res2, m)
    584      endif
    585    endfor
    586 
    587    return res + res2
    588 
    589  elseif borders[max(keys(borders))] == 'closebrace'
    590 
    591    return []
    592 
    593  elseif borders[max(keys(borders))] == 'exclam'
    594 
    595    " Complete values
    596    let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
    597 
    598    let values = ["important"]
    599 
    600    for m in values
    601      if m =~? '^'.entered_imp
    602        call add(res, m)
    603      endif
    604    endfor
    605 
    606    return res
    607 
    608  elseif borders[max(keys(borders))] == 'atrule'
    609 
    610    let afterat = matchstr(line, '.*@\zs.*')
    611 
    612    if afterat =~ '\s'
    613 
    614      let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze')
    615 
    616      if atrulename == 'media'
    617        let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$')
    618 
    619        if entered_atruleafter =~ "([^)]*$"
    620          let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs[^)]*$')
    621          let values = ["max-width", "min-width", "width", "max-height", "min-height", "height", "max-aspect-ration", "min-aspect-ration", "aspect-ratio", "orientation", "max-resolution", "min-resolution", "resolution", "scan", "grid", "update-frequency", "overflow-block", "overflow-inline", "max-color", "min-color", "color", "max-color-index", "min-color-index", "color-index", "monochrome", "inverted-colors", "pointer", "hover", "any-pointer", "any-hover", "light-level", "scripting"]
    622        else
    623          let values = ["screen", "print", "speech", "all", "not", "and", "("]
    624        endif
    625 
    626      elseif atrulename == 'supports'
    627        let entered_atruleafter = matchstr(line, '.*@supports\s\+\zs.*$')
    628 
    629        if entered_atruleafter =~ "([^)]*$"
    630          let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs.*$')
    631          let values = s:values
    632        else
    633          let values = ["("]
    634        endif
    635 
    636      elseif atrulename == 'charset'
    637        let entered_atruleafter = matchstr(line, '.*@charset\s\+\zs.*$')
    638        let values = [
    639          \ '"UTF-8";', '"ANSI_X3.4-1968";', '"ISO_8859-1:1987";', '"ISO_8859-2:1987";', '"ISO_8859-3:1988";', '"ISO_8859-4:1988";', '"ISO_8859-5:1988";', 
    640          \ '"ISO_8859-6:1987";', '"ISO_8859-7:1987";', '"ISO_8859-8:1988";', '"ISO_8859-9:1989";', '"ISO-8859-10";', '"ISO_6937-2-add";', '"JIS_X0201";', 
    641          \ '"JIS_Encoding";', '"Shift_JIS";', '"Extended_UNIX_Code_Packed_Format_for_Japanese";', '"Extended_UNIX_Code_Fixed_Width_for_Japanese";',
    642          \ '"BS_4730";', '"SEN_850200_C";', '"IT";', '"ES";', '"DIN_66003";', '"NS_4551-1";', '"NF_Z_62-010";', '"ISO-10646-UTF-1";', '"ISO_646.basic:1983";',
    643          \ '"INVARIANT";', '"ISO_646.irv:1983";', '"NATS-SEFI";', '"NATS-SEFI-ADD";', '"NATS-DANO";', '"NATS-DANO-ADD";', '"SEN_850200_B";', '"KS_C_5601-1987";',
    644          \ '"ISO-2022-KR";', '"EUC-KR";', '"ISO-2022-JP";', '"ISO-2022-JP-2";', '"JIS_C6220-1969-jp";', '"JIS_C6220-1969-ro";', '"PT";', '"greek7-old";', 
    645          \ '"latin-greek";', '"NF_Z_62-010_(1973)";', '"Latin-greek-1";', '"ISO_5427";', '"JIS_C6226-1978";', '"BS_viewdata";', '"INIS";', '"INIS-8";', 
    646          \ '"INIS-cyrillic";', '"ISO_5427:1981";', '"ISO_5428:1980";', '"GB_1988-80";', '"GB_2312-80";', '"NS_4551-2";', '"videotex-suppl";', '"PT2";', 
    647          \ '"ES2";', '"MSZ_7795.3";', '"JIS_C6226-1983";', '"greek7";', '"ASMO_449";', '"iso-ir-90";', '"JIS_C6229-1984-a";', '"JIS_C6229-1984-b";', 
    648          \ '"JIS_C6229-1984-b-add";', '"JIS_C6229-1984-hand";', '"JIS_C6229-1984-hand-add";', '"JIS_C6229-1984-kana";', '"ISO_2033-1983";', 
    649          \ '"ANSI_X3.110-1983";', '"T.61-7bit";', '"T.61-8bit";', '"ECMA-cyrillic";', '"CSA_Z243.4-1985-1";', '"CSA_Z243.4-1985-2";', '"CSA_Z243.4-1985-gr";', 
    650          \ '"ISO_8859-6-E";', '"ISO_8859-6-I";', '"T.101-G2";', '"ISO_8859-8-E";', '"ISO_8859-8-I";', '"CSN_369103";', '"JUS_I.B1.002";', '"IEC_P27-1";', 
    651          \ '"JUS_I.B1.003-serb";', '"JUS_I.B1.003-mac";', '"greek-ccitt";', '"NC_NC00-10:81";', '"ISO_6937-2-25";', '"GOST_19768-74";', '"ISO_8859-supp";', 
    652          \ '"ISO_10367-box";', '"latin-lap";', '"JIS_X0212-1990";', '"DS_2089";', '"us-dk";', '"dk-us";', '"KSC5636";', '"UNICODE-1-1-UTF-7";', '"ISO-2022-CN";', 
    653          \ '"ISO-2022-CN-EXT";', '"ISO-8859-13";', '"ISO-8859-14";', '"ISO-8859-15";', '"ISO-8859-16";', '"GBK";', '"GB18030";', '"OSD_EBCDIC_DF04_15";', 
    654          \ '"OSD_EBCDIC_DF03_IRV";', '"OSD_EBCDIC_DF04_1";', '"ISO-11548-1";', '"KZ-1048";', '"ISO-10646-UCS-2";', '"ISO-10646-UCS-4";', '"ISO-10646-UCS-Basic";',
    655          \ '"ISO-10646-Unicode-Latin1";', '"ISO-10646-J-1";', '"ISO-Unicode-IBM-1261";', '"ISO-Unicode-IBM-1268";', '"ISO-Unicode-IBM-1276";', 
    656          \ '"ISO-Unicode-IBM-1264";', '"ISO-Unicode-IBM-1265";', '"UNICODE-1-1";', '"SCSU";', '"UTF-7";', '"UTF-16BE";', '"UTF-16LE";', '"UTF-16";', '"CESU-8";', 
    657          \ '"UTF-32";', '"UTF-32BE";', '"UTF-32LE";', '"BOCU-1";', '"ISO-8859-1-Windows-3.0-Latin-1";', '"ISO-8859-1-Windows-3.1-Latin-1";', 
    658          \ '"ISO-8859-2-Windows-Latin-2";', '"ISO-8859-9-Windows-Latin-5";', '"hp-roman8";', '"Adobe-Standard-Encoding";', '"Ventura-US";', 
    659          \ '"Ventura-International";', '"DEC-MCS";', '"IBM850";', '"PC8-Danish-Norwegian";', '"IBM862";', '"PC8-Turkish";', '"IBM-Symbols";', '"IBM-Thai";', 
    660          \ '"HP-Legal";', '"HP-Pi-font";', '"HP-Math8";', '"Adobe-Symbol-Encoding";', '"HP-DeskTop";', '"Ventura-Math";', '"Microsoft-Publishing";', 
    661          \ '"Windows-31J";', '"GB2312";', '"Big5";', '"macintosh";', '"IBM037";', '"IBM038";', '"IBM273";', '"IBM274";', '"IBM275";', '"IBM277";', '"IBM278";', 
    662          \ '"IBM280";', '"IBM281";', '"IBM284";', '"IBM285";', '"IBM290";', '"IBM297";', '"IBM420";', '"IBM423";', '"IBM424";', '"IBM437";', '"IBM500";', '"IBM851";', 
    663          \ '"IBM852";', '"IBM855";', '"IBM857";', '"IBM860";', '"IBM861";', '"IBM863";', '"IBM864";', '"IBM865";', '"IBM868";', '"IBM869";', '"IBM870";', '"IBM871";', 
    664          \ '"IBM880";', '"IBM891";', '"IBM903";', '"IBM904";', '"IBM905";', '"IBM918";', '"IBM1026";', '"EBCDIC-AT-DE";', '"EBCDIC-AT-DE-A";', '"EBCDIC-CA-FR";', 
    665          \ '"EBCDIC-DK-NO";', '"EBCDIC-DK-NO-A";', '"EBCDIC-FI-SE";', '"EBCDIC-FI-SE-A";', '"EBCDIC-FR";', '"EBCDIC-IT";', '"EBCDIC-PT";', '"EBCDIC-ES";', 
    666          \ '"EBCDIC-ES-A";', '"EBCDIC-ES-S";', '"EBCDIC-UK";', '"EBCDIC-US";', '"UNKNOWN-8BIT";', '"MNEMONIC";', '"MNEM";', '"VISCII";', '"VIQR";', '"KOI8-R";', 
    667          \ '"HZ-GB-2312";', '"IBM866";', '"IBM775";', '"KOI8-U";', '"IBM00858";', '"IBM00924";', '"IBM01140";', '"IBM01141";', '"IBM01142";', '"IBM01143";', 
    668          \ '"IBM01144";', '"IBM01145";', '"IBM01146";', '"IBM01147";', '"IBM01148";', '"IBM01149";', '"Big5-HKSCS";', '"IBM1047";', '"PTCP154";', '"Amiga-1251";', 
    669          \ '"KOI7-switched";', '"BRF";', '"TSCII";', '"windows-1250";', '"windows-1251";', '"windows-1252";', '"windows-1253";', '"windows-1254";', '"windows-1255";', 
    670          \ '"windows-1256";', '"windows-1257";', '"windows-1258";', '"TIS-620";']
    671 
    672      elseif atrulename == 'namespace'
    673        let entered_atruleafter = matchstr(line, '.*@namespace\s\+\zs.*$')
    674        let values = ["url("]
    675 
    676      elseif atrulename == 'document'
    677        let entered_atruleafter = matchstr(line, '.*@document\s\+\zs.*$')
    678        let values = ["url(", "url-prefix(", "domain(", "regexp("]
    679 
    680      elseif atrulename == 'import'
    681        let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$')
    682 
    683        if entered_atruleafter =~ "^[\"']"
    684          let filestart = matchstr(entered_atruleafter, '^.\zs.*')
    685          let files = split(glob(filestart.'*'), '\n')
    686          let values = map(copy(files), '"\"".v:val')
    687 
    688        elseif entered_atruleafter =~ "^url("
    689          let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
    690          let files = split(glob(filestart.'*'), '\n')
    691          let values = map(copy(files), '"url(".v:val')
    692 
    693        else
    694          let values = ['"', 'url(']
    695 
    696        endif
    697 
    698      else
    699        return []
    700 
    701      endif
    702 
    703      for m in values
    704        if m =~? '^'.entered_atruleafter
    705          if entered_atruleafter =~? '^"' && m =~? '^"'
    706            let m = m[1:]
    707          endif
    708          if b:after =~? '"' && stridx(m, '"') > -1
    709            let m = m[0:stridx(m, '"')-1]
    710          endif 
    711          call add(res, m)
    712        elseif m =~? entered_atruleafter
    713          if m =~? '^"'
    714            let m = m[1:]
    715          endif
    716          call add(res2, m)
    717        endif
    718      endfor
    719 
    720      return res + res2
    721 
    722    endif
    723 
    724    let values = ["charset", "page", "media", "import", "font-face", "namespace", "supports", "keyframes", "viewport", "document"]
    725 
    726    let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
    727 
    728    for m in values
    729      if m =~? '^'.entered_atrule
    730        call add(res, m .' ')
    731      elseif m =~? entered_atrule
    732        call add(res2, m .' ')
    733      endif
    734    endfor
    735 
    736    return res + res2
    737 
    738  endif
    739 
    740  return []
    741 
    742 endfunction