csscomplete.vim 42 KB

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