annotate runtime/autoload/csscomplete.vim @ 4079:0b140173d14f

Added tag v7-3-793 for changeset fdbded463fdc
author Bram Moolenaar <bram@vim.org>
date Wed, 30 Jan 2013 17:03:30 +0100
parents 2bf08b6fa352
children 41768bcebc9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
1 " Vim completion script
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
2 " Language: CSS 2.1
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
3 " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
1196
2bf08b6fa352 updated for version 7.1b
vimboss
parents: 1121
diff changeset
4 " Last Change: 2007 May 5
2bf08b6fa352 updated for version 7.1b
vimboss
parents: 1121
diff changeset
5
2bf08b6fa352 updated for version 7.1b
vimboss
parents: 1121
diff changeset
6 let s:values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index")
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
7
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
8 function! csscomplete#CompleteCSS(findstart, base)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
9
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
10 if a:findstart
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
11 " We need whole line to proper checking
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
12 let line = getline('.')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
13 let start = col('.') - 1
548
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
14 let compl_begin = col('.') - 2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
15 while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
548
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
16 let start -= 1
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
17 endwhile
1196
2bf08b6fa352 updated for version 7.1b
vimboss
parents: 1121
diff changeset
18 let b:compl_context = line[0:compl_begin]
548
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
19 return start
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
20 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
21
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
22 " There are few chars important for context:
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
23 " ^ ; : { } /* */
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
24 " Where ^ is start of line and /* */ are comment borders
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
25 " Depending on their relative position to cursor we will know what should
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
26 " be completed.
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
27 " 1. if nearest are ^ or { or ; current word is property
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
28 " 2. if : it is value (with exception of pseudo things)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
29 " 3. if } we are outside of css definitions
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
30 " 4. for comments ignoring is be the easiest but assume they are the same
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
31 " as 1.
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
32 " 5. if @ complete at-rule
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
33 " 6. if ! complete important
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
34 if exists("b:compl_context")
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
35 let line = b:compl_context
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
36 unlet! b:compl_context
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
37 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
38 let line = a:base
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
39 endif
548
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
40
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
41 let res = []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
42 let res2 = []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
43 let borders = {}
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
44
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
45 " Check last occurrence of sequence
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 531
diff changeset
46
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
47 let openbrace = strridx(line, '{')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
48 let closebrace = strridx(line, '}')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
49 let colon = strridx(line, ':')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
50 let semicolon = strridx(line, ';')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
51 let opencomm = strridx(line, '/*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
52 let closecomm = strridx(line, '*/')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
53 let style = strridx(line, 'style\s*=')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
54 let atrule = strridx(line, '@')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
55 let exclam = strridx(line, '!')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
56
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
57 if openbrace > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
58 let borders[openbrace] = "openbrace"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
59 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
60 if closebrace > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
61 let borders[closebrace] = "closebrace"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
62 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
63 if colon > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
64 let borders[colon] = "colon"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
65 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
66 if semicolon > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
67 let borders[semicolon] = "semicolon"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
68 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
69 if opencomm > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
70 let borders[opencomm] = "opencomm"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
71 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
72 if closecomm > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
73 let borders[closecomm] = "closecomm"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
74 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
75 if style > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
76 let borders[style] = "style"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
77 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
78 if atrule > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
79 let borders[atrule] = "atrule"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
80 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
81 if exclam > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
82 let borders[exclam] = "exclam"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
83 endif
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
84
548
f43150a669dc updated for version 7.0155
vimboss
parents: 539
diff changeset
85
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
86 if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
87 " Complete properties
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
88
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
89
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
90 let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
91
1196
2bf08b6fa352 updated for version 7.1b
vimboss
parents: 1121
diff changeset
92 for m in s:values
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
93 if m =~? '^'.entered_property
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
94 call add(res, m . ':')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
95 elseif m =~? entered_property
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
96 call add(res2, m . ':')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
97 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
98 endfor
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
99
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
100 return res + res2
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
101
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
102 elseif borders[max(keys(borders))] == 'colon'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
103 " Get name of property
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
104 let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$'))
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
105
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
106 if prop == 'azimuth'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
107 let values = ["left-side", "far-left", "left", "center-left", "center", "center-right", "right", "far-right", "right-side", "behind", "leftwards", "rightwards"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
108 elseif prop == 'background-attachment'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
109 let values = ["scroll", "fixed"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
110 elseif prop == 'background-color'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
111 let values = ["transparent", "rgb(", "#"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
112 elseif prop == 'background-image'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
113 let values = ["url(", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
114 elseif prop == 'background-position'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
115 let vals = matchstr(line, '.*:\s*\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
116 if vals =~ '^\%([a-zA-Z]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
117 let values = ["top", "center", "bottom"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
118 elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
119 let values = ["left", "center", "right"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
120 else
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
121 return []
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
122 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
123 elseif prop == 'background-repeat'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
124 let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
125 elseif prop == 'background'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
126 let values = ["url(", "scroll", "fixed", "transparent", "rgb(", "#", "none", "top", "center", "bottom" , "left", "right", "repeat", "repeat-x", "repeat-y", "no-repeat"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
127 elseif prop == 'border-collapse'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
128 let values = ["collapse", "separate"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
129 elseif prop == 'border-color'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
130 let values = ["rgb(", "#", "transparent"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
131 elseif prop == 'border-spacing'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
132 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
133 elseif prop == 'border-style'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
134 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
135 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
136 let vals = matchstr(line, '.*:\s*\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
137 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
138 let values = ["thin", "thick", "medium"]
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
139 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
140 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
141 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
142 let values = ["rgb(", "#", "transparent"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
143 else
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
144 return []
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
145 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
146 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-color'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
147 let values = ["rgb(", "#", "transparent"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
148 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-style'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
149 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
150 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-width'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
151 let values = ["thin", "thick", "medium"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
152 elseif prop == 'border-width'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
153 let values = ["thin", "thick", "medium"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
154 elseif prop == 'border'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
155 let vals = matchstr(line, '.*:\s*\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
156 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
157 let values = ["thin", "thick", "medium"]
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
158 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
159 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
160 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
161 let values = ["rgb(", "#", "transparent"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
162 else
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
163 return []
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
164 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
165 elseif prop == 'bottom'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
166 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
167 elseif prop == 'caption-side'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
168 let values = ["top", "bottom"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
169 elseif prop == 'clear'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
170 let values = ["none", "left", "right", "both"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
171 elseif prop == 'clip'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
172 let values = ["auto", "rect("]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
173 elseif prop == 'color'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
174 let values = ["rgb(", "#"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
175 elseif prop == 'content'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
176 let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
177 elseif prop =~ 'counter-\%(increment\|reset\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
178 let values = ["none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
179 elseif prop =~ '^\%(cue-after\|cue-before\|cue\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
180 let values = ["url(", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
181 elseif prop == 'cursor'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
182 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"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
183 elseif prop == 'direction'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
184 let values = ["ltr", "rtl"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
185 elseif prop == 'display'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
186 let values = ["inline", "block", "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"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
187 elseif prop == 'elevation'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
188 let values = ["below", "level", "above", "higher", "lower"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
189 elseif prop == 'empty-cells'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
190 let values = ["show", "hide"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
191 elseif prop == 'float'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
192 let values = ["left", "right", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
193 elseif prop == 'font-family'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
194 let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
195 elseif prop == 'font-size'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
196 let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
197 elseif prop == 'font-style'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
198 let values = ["normal", "italic", "oblique"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
199 elseif prop == 'font-variant'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
200 let values = ["normal", "small-caps"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
201 elseif prop == 'font-weight'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
202 let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
203 elseif prop == 'font'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
204 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"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
205 elseif prop =~ '^\%(height\|width\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
206 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
207 elseif prop =~ '^\%(left\|rigth\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
208 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
209 elseif prop == 'letter-spacing'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
210 let values = ["normal"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
211 elseif prop == 'line-height'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
212 let values = ["normal"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
213 elseif prop == 'list-style-image'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
214 let values = ["url(", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
215 elseif prop == 'list-style-position'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
216 let values = ["inside", "outside"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
217 elseif prop == 'list-style-type'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
218 let values = ["disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-latin", "upper-latin", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
219 elseif prop == 'list-style'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
220 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
221 elseif prop == 'margin'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
222 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
223 elseif prop =~ 'margin-\%(right\|left\|top\|bottom\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
224 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
225 elseif prop == 'max-height'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
226 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
227 elseif prop == 'max-width'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
228 let values = ["none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
229 elseif prop == 'min-height'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
230 let values = ["none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
231 elseif prop == 'min-width'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
232 let values = ["none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
233 elseif prop == 'orphans'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
234 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
235 elseif prop == 'outline-color'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
236 let values = ["rgb(", "#"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
237 elseif prop == 'outline-style'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
238 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
239 elseif prop == 'outline-width'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
240 let values = ["thin", "thick", "medium"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
241 elseif prop == 'outline'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
242 let vals = matchstr(line, '.*:\s*\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
243 if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
244 let values = ["rgb(", "#"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
245 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
246 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
247 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
248 let values = ["thin", "thick", "medium"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
249 else
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
250 return []
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
251 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
252 elseif prop == 'overflow'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
253 let values = ["visible", "hidden", "scroll", "auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
254 elseif prop == 'padding'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
255 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
256 elseif prop =~ 'padding-\%(top\|right\|bottom\|left\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
257 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
258 elseif prop =~ 'page-break-\%(after\|before\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
259 let values = ["auto", "always", "avoid", "left", "right"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
260 elseif prop == 'page-break-inside'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
261 let values = ["auto", "avoid"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
262 elseif prop =~ 'pause-\%(after\|before\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
263 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
264 elseif prop == 'pause'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
265 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
266 elseif prop == 'pitch-range'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
267 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
268 elseif prop == 'pitch'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
269 let values = ["x-low", "low", "medium", "high", "x-high"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
270 elseif prop == 'play-during'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
271 let values = ["url(", "mix", "repeat", "auto", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
272 elseif prop == 'position'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
273 let values = ["static", "relative", "absolute", "fixed"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
274 elseif prop == 'quotes'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
275 let values = ["none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
276 elseif prop == 'richness'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
277 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
278 elseif prop == 'speak-header'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
279 let values = ["once", "always"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
280 elseif prop == 'speak-numeral'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
281 let values = ["digits", "continuous"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
282 elseif prop == 'speak-punctuation'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
283 let values = ["code", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
284 elseif prop == 'speak'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
285 let values = ["normal", "none", "spell-out"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
286 elseif prop == 'speech-rate'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
287 let values = ["x-slow", "slow", "medium", "fast", "x-fast", "faster", "slower"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
288 elseif prop == 'stress'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
289 return []
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
290 elseif prop == 'table-layout'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
291 let values = ["auto", "fixed"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
292 elseif prop == 'text-align'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
293 let values = ["left", "right", "center", "justify"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
294 elseif prop == 'text-decoration'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
295 let values = ["none", "underline", "overline", "line-through", "blink"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
296 elseif prop == 'text-indent'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
297 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
298 elseif prop == 'text-transform'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
299 let values = ["capitalize", "uppercase", "lowercase", "none"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
300 elseif prop == 'top'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
301 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
302 elseif prop == 'unicode-bidi'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
303 let values = ["normal", "embed", "bidi-override"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
304 elseif prop == 'vertical-align'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
305 let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
306 elseif prop == 'visibility'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
307 let values = ["visible", "hidden", "collapse"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
308 elseif prop == 'voice-family'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
309 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
310 elseif prop == 'volume'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
311 let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
312 elseif prop == 'white-space'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
313 let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
314 elseif prop == 'widows'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
315 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
316 elseif prop == 'word-spacing'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
317 let values = ["normal"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
318 elseif prop == 'z-index'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
319 let values = ["auto"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
320 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
321 " If no property match it is possible we are outside of {} and
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
322 " trying to complete pseudo-(class|element)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
323 let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$'))
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
324 if stridx(',a,abbr,acronym,address,area,b,base,bdo,big,blockquote,body,br,button,caption,cite,code,col,colgroup,dd,del,dfn,div,dl,dt,em,fieldset,form,head,h1,h2,h3,h4,h5,h6,hr,html,i,img,input,ins,kbd,label,legend,li,link,map,meta,noscript,object,ol,optgroup,option,p,param,pre,q,samp,script,select,small,span,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,ul,var,', ','.element.',') > -1
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
325 let values = ["first-child", "link", "visited", "hover", "active", "focus", "lang", "first-line", "first-letter", "before", "after"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
326 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
327 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
328 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
329 endif
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 531
diff changeset
330
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
331 " Complete values
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
332 let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 531
diff changeset
333
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
334 for m in values
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
335 if m =~? '^'.entered_value
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
336 call add(res, m)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
337 elseif m =~? entered_value
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
338 call add(res2, m)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
339 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
340 endfor
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 531
diff changeset
341
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
342 return res + res2
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
343
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
344 elseif borders[max(keys(borders))] == 'closebrace'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
345
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
346 return []
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
347
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
348 elseif borders[max(keys(borders))] == 'exclam'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
349
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
350 " Complete values
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
351 let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
352
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
353 let values = ["important"]
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
354
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
355 for m in values
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
356 if m =~? '^'.entered_imp
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
357 call add(res, m)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
358 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
359 endfor
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
360
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
361 return res
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
362
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
363 elseif borders[max(keys(borders))] == 'atrule'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
364
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
365 let afterat = matchstr(line, '.*@\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
366
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
367 if afterat =~ '\s'
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
368
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
369 let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
370
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
371 if atrulename == 'media'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
372 let values = ["screen", "tty", "tv", "projection", "handheld", "print", "braille", "aural", "all"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
373
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
374 let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
375
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
376 elseif atrulename == 'import'
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
377 let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$')
856
8cd729851562 updated for version 7.0g
vimboss
parents: 553
diff changeset
378
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
379 if entered_atruleafter =~ "^[\"']"
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
380 let filestart = matchstr(entered_atruleafter, '^.\zs.*')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
381 let files = split(glob(filestart.'*'), '\n')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
382 let values = map(copy(files), '"\"".v:val')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
383
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
384 elseif entered_atruleafter =~ "^url("
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
385 let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
386 let files = split(glob(filestart.'*'), '\n')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
387 let values = map(copy(files), '"url(".v:val')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
388
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
389 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
390 let values = ['"', 'url(']
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
391
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
392 endif
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
393
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
394 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
395 return []
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
396
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
397 endif
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
398
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
399 for m in values
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
400 if m =~? '^'.entered_atruleafter
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
401 call add(res, m)
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
402 elseif m =~? entered_atruleafter
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
403 call add(res2, m)
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
404 endif
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
405 endfor
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
406
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
407 return res + res2
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
408
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
409 endif
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
410
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
411 let values = ["charset", "page", "media", "import", "font-face"]
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
412
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
413 let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
414
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
415 for m in values
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
416 if m =~? '^'.entered_atrule
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
417 call add(res, m .' ')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
418 elseif m =~? entered_atrule
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
419 call add(res2, m .' ')
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
420 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
421 endfor
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
422
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
423 return res + res2
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
424
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
425 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
426
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
427 return []
e63691e7c504 updated for version 7.1a
vimboss
parents: 856
diff changeset
428
531
da9142bd190a updated for version 7.0149
vimboss
parents:
diff changeset
429 endfunction