blob: 984ba8b58ede68e2854c392a3682dd42779fc4e9 [file] [log] [blame]
Bram Moolenaarf75a9632005-09-13 21:20:47 +00001" Vim completion script
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00002" Language: HTML and XHTML
Bram Moolenaarf75a9632005-09-13 21:20:47 +00003" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
Bram Moolenaar946e27a2014-06-25 18:50:27 +02004" Last Change: 2014 Jun 20
5
6" Distinguish between HTML versions.
7" To use with other HTML versions add another "elseif" condition to match
8" proper DOCTYPE.
9function! htmlcomplete#DetectOmniFlavor()
10 if &filetype == 'xhtml'
11 let b:html_omni_flavor = 'xhtml10s'
12 else
13 let b:html_omni_flavor = 'html401t'
14 endif
15 let i = 1
16 let line = ""
17 while i < 10 && i < line("$")
18 let line = getline(i)
19 if line =~ '<!DOCTYPE.*\<DTD '
20 break
21 endif
22 let i += 1
23 endwhile
24 if line =~ '<!DOCTYPE.*\<DTD ' " doctype line found above
25 if line =~ ' HTML 3\.2'
26 let b:html_omni_flavor = 'html32'
27 elseif line =~ ' XHTML 1\.1'
28 let b:html_omni_flavor = 'xhtml11'
29 else " two-step detection with strict/frameset/transitional
30 if line =~ ' XHTML 1\.0'
31 let b:html_omni_flavor = 'xhtml10'
32 elseif line =~ ' HTML 4\.01'
33 let b:html_omni_flavor = 'html401'
34 elseif line =~ ' HTML 4.0\>'
35 let b:html_omni_flavor = 'html40'
36 endif
37 if line =~ '\<Transitional\>'
38 let b:html_omni_flavor .= 't'
39 elseif line =~ '\<Frameset\>'
40 let b:html_omni_flavor .= 'f'
41 else
42 let b:html_omni_flavor .= 's'
43 endif
44 endif
45 endif
46endfunction
Bram Moolenaarf75a9632005-09-13 21:20:47 +000047
48function! htmlcomplete#CompleteTags(findstart, base)
49 if a:findstart
50 " locate the start of the word
51 let line = getline('.')
52 let start = col('.') - 1
Bram Moolenaar28c258f2006-01-25 22:02:51 +000053 let curline = line('.')
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000054 let compl_begin = col('.') - 2
Bram Moolenaar4a85b412006-04-23 22:40:29 +000055 while start >= 0 && line[start - 1] =~ '\(\k\|[!:.-]\)'
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000056 let start -= 1
Bram Moolenaarf75a9632005-09-13 21:20:47 +000057 endwhile
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000058 " Handling of entities {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000059 if start >= 0 && line[start - 1] =~ '&'
60 let b:entitiescompl = 1
61 let b:compl_context = ''
62 return start
63 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000064 " }}}
65 " Handling of <style> tag {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000066 let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
67 let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000068 if stylestart != 0 && styleend != 0
Bram Moolenaar28c258f2006-01-25 22:02:51 +000069 if stylestart <= curline && styleend >= curline
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000070 let start = col('.') - 1
71 let b:csscompl = 1
72 while start >= 0 && line[start - 1] =~ '\(\k\|-\)'
73 let start -= 1
74 endwhile
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +000075 endif
76 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000077 " }}}
78 " Handling of <script> tag {{{
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000079 let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW")
80 let scriptend = searchpair('<script\>', '', '<\/script\>', "nW")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000081 if scriptstart != 0 && scriptend != 0
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000082 if scriptstart <= curline && scriptend >= curline
83 let start = col('.') - 1
84 let b:jscompl = 1
85 let b:jsrange = [scriptstart, scriptend]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +000086 while start >= 0 && line[start - 1] =~ '\k'
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000087 let start -= 1
88 endwhile
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000089 " We are inside of <script> tag. But we should also get contents
90 " of all linked external files and (secondary, less probably) other <script> tags
91 " This logic could possible be done in separate function - may be
92 " reused in events scripting (also with option could be reused for
93 " CSS
94 let b:js_extfiles = []
95 let l = line('.')
96 let c = col('.')
97 call cursor(1,1)
98 while search('<\@<=script\>', 'W') && line('.') <= l
99 if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
100 let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
101 if filereadable(sname)
102 let b:js_extfiles += readfile(sname)
103 endif
104 endif
105 endwhile
106 call cursor(1,1)
107 let js_scripttags = []
108 while search('<script\>', 'W') && line('.') < l
109 if matchstr(getline('.'), '<script[^>]*src') == ''
110 let js_scripttag = getline(line('.'), search('</script>', 'W'))
111 let js_scripttags += js_scripttag
112 endif
113 endwhile
114 let b:js_extfiles += js_scripttags
115 call cursor(l,c)
116 unlet! l c
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000117 endif
118 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000119 " }}}
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000120 if !exists("b:csscompl") && !exists("b:jscompl")
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000121 let b:compl_context = getline('.')[0:(compl_begin)]
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000122 if b:compl_context !~ '<[^>]*$'
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000123 " Look like we may have broken tag. Check previous lines.
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000124 let i = 1
125 while 1
126 let context_line = getline(curline-i)
127 if context_line =~ '<[^>]*$'
128 " Yep, this is this line
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000129 let context_lines = getline(curline-i, curline-1) + [b:compl_context]
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000130 let b:compl_context = join(context_lines, ' ')
131 break
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000132 elseif context_line =~ '>[^<]*$' || i == curline
133 " We are in normal tag line, no need for completion at all
134 " OR reached first line without tag at all
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000135 let b:compl_context = ''
136 break
137 endif
138 let i += 1
139 endwhile
140 " Make sure we don't have counter
141 unlet! i
142 endif
Bram Moolenaar09df3122006-01-23 22:23:09 +0000143 let b:compl_context = matchstr(b:compl_context, '.*\zs<.*')
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000144
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000145 " Return proper start for on-events. Without that beginning of
146 " completion will be badly reported
147 if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
148 let start = col('.') - 1
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000149 while start >= 0 && line[start - 1] =~ '\k'
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000150 let start -= 1
151 endwhile
152 endif
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000153 " If b:compl_context begins with <? we are inside of PHP code. It
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000154 " wasn't closed so PHP completion passed it to HTML
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000155 if &filetype =~? 'php' && b:compl_context =~ '^<?'
156 let b:phpcompl = 1
157 let start = col('.') - 1
158 while start >= 0 && line[start - 1] =~ '[a-zA-Z_0-9\x7f-\xff$]'
159 let start -= 1
160 endwhile
161 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000162 else
163 let b:compl_context = getline('.')[0:compl_begin]
164 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000165 return start
166 else
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000167 " Initialize base return lists
168 let res = []
169 let res2 = []
170 " a:base is very short - we need context
171 let context = b:compl_context
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000172 " Check if we should do CSS completion inside of <style> tag
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000173 " or JS completion inside of <script> tag or PHP completion in case of <?
174 " tag AND &ft==php
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000175 if exists("b:csscompl")
176 unlet! b:csscompl
Bram Moolenaar09df3122006-01-23 22:23:09 +0000177 let context = b:compl_context
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000178 unlet! b:compl_context
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000179 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000180 elseif exists("b:jscompl")
181 unlet! b:jscompl
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000182 return javascriptcomplete#CompleteJS(0, a:base)
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000183 elseif exists("b:phpcompl")
184 unlet! b:phpcompl
185 let context = b:compl_context
186 return phpcomplete#CompletePHP(0, a:base)
Bram Moolenaar09df3122006-01-23 22:23:09 +0000187 else
188 if len(b:compl_context) == 0 && !exists("b:entitiescompl")
189 return []
190 endif
191 let context = matchstr(b:compl_context, '.\zs.*')
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000192 endif
Bram Moolenaar09df3122006-01-23 22:23:09 +0000193 unlet! b:compl_context
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000194 " Entities completion {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000195 if exists("b:entitiescompl")
196 unlet! b:entitiescompl
197
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000198 if !exists("b:html_doctype")
199 call htmlcomplete#CheckDoctype()
200 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000201 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000202 "runtime! autoload/xml/xhtml10s.vim
203 call htmlcomplete#LoadData()
Bram Moolenaara5792f52005-11-23 21:25:05 +0000204 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000205
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000206 let entities = b:html_omni['vimxmlentities']
Bram Moolenaara5792f52005-11-23 21:25:05 +0000207
Bram Moolenaar09df3122006-01-23 22:23:09 +0000208 if len(a:base) == 1
209 for m in entities
210 if m =~ '^'.a:base
211 call add(res, m.';')
212 endif
213 endfor
214 return res
215 else
216 for m in entities
217 if m =~? '^'.a:base
218 call add(res, m.';')
219 elseif m =~? a:base
220 call add(res2, m.';')
221 endif
222 endfor
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000223
Bram Moolenaar09df3122006-01-23 22:23:09 +0000224 return res + res2
225 endif
226
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000227
228 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000229 " }}}
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000230 if context =~ '>'
231 " Generally if context contains > it means we are outside of tag and
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000232 " should abandon action - with one exception: <style> span { bo
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000233 if context =~ 'style[^>]\{-}>[^<]\{-}$'
234 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000235 elseif context =~ 'script[^>]\{-}>[^<]\{-}$'
236 let b:jsrange = [line('.'), search('<\/script\>', 'nW')]
237 return javascriptcomplete#CompleteJS(0, context)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000238 else
239 return []
240 endif
241 endif
242
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000243 " If context contains > it means we are already outside of tag and we
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000244 " should abandon action
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000245 " If context contains white space it is attribute.
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000246 " It can be also value of attribute.
247 " We have to get first word to offer proper completions
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000248 if context == ''
249 let tag = ''
250 else
251 let tag = split(context)[0]
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000252 " Detect if tag is uppercase to return in proper case,
253 " we need to make it lowercase for processing
254 if tag =~ '^[A-Z]*$'
Bram Moolenaar8424a622006-04-19 21:23:36 +0000255 let uppercase_tag = 1
256 let tag = tolower(tag)
257 else
258 let uppercase_tag = 0
259 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000260 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000261 " Get last word, it should be attr name
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000262 let attr = matchstr(context, '.*\s\zs.*')
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000263 " Possible situations where any prediction would be difficult:
264 " 1. Events attributes
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000265 if context =~ '\s'
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000266 " Sort out style, class, and on* cases
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000267 if context =~? "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
268 " Id, class completion {{{
269 if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
270 if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
Bram Moolenaar1e015462005-09-25 22:16:38 +0000271 let search_for = "class"
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000272 elseif context =~? "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
Bram Moolenaar1e015462005-09-25 22:16:38 +0000273 let search_for = "id"
274 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000275 " Handle class name completion
276 " 1. Find lines of <link stylesheet>
277 " 1a. Check file for @import
278 " 2. Extract filename(s?) of stylesheet,
279 call cursor(1,1)
280 let head = getline(search('<head\>'), search('<\/head>'))
281 let headjoined = join(copy(head), ' ')
282 if headjoined =~ '<style'
Bram Moolenaara5792f52005-11-23 21:25:05 +0000283 " Remove possibly confusing CSS operators
Bram Moolenaar1e015462005-09-25 22:16:38 +0000284 let stylehead = substitute(headjoined, '+>\*[,', ' ', 'g')
285 if search_for == 'class'
286 let styleheadlines = split(stylehead)
287 let headclasslines = filter(copy(styleheadlines), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
288 else
289 let stylesheet = split(headjoined, '[{}]')
290 " Get all lines which fit id syntax
291 let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
292 " Filter out possible color definitions
293 call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
294 " Filter out complex border definitions
295 call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
296 let templines = join(classlines, ' ')
297 let headclasslines = split(templines)
298 call filter(headclasslines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
299 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000300 let internal = 1
301 else
302 let internal = 0
303 endif
304 let styletable = []
305 let secimportfiles = []
306 let filestable = filter(copy(head), "v:val =~ '\\(@import\\|link.*stylesheet\\)'")
307 for line in filestable
308 if line =~ "@import"
309 let styletable += [matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")]
310 elseif line =~ "<link"
311 let styletable += [matchstr(line, "href\\s*=\\s*[\"']\\zs\\f\\+\\ze")]
312 endif
313 endfor
Bram Moolenaar1e015462005-09-25 22:16:38 +0000314 for file in styletable
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000315 if filereadable(file)
316 let stylesheet = readfile(file)
317 let secimport = filter(copy(stylesheet), "v:val =~ '@import'")
318 if len(secimport) > 0
319 for line in secimport
Bram Moolenaar1e015462005-09-25 22:16:38 +0000320 let secfile = matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")
321 let secfile = fnamemodify(file, ":p:h").'/'.secfile
322 let secimportfiles += [secfile]
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000323 endfor
324 endif
325 endif
326 endfor
327 let cssfiles = styletable + secimportfiles
328 let classes = []
329 for file in cssfiles
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +0200330 let classlines = []
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000331 if filereadable(file)
332 let stylesheet = readfile(file)
Bram Moolenaar1e015462005-09-25 22:16:38 +0000333 let stylefile = join(stylesheet, ' ')
334 let stylefile = substitute(stylefile, '+>\*[,', ' ', 'g')
335 if search_for == 'class'
336 let stylesheet = split(stylefile)
337 let classlines = filter(copy(stylesheet), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
338 else
339 let stylesheet = split(stylefile, '[{}]')
340 " Get all lines which fit id syntax
341 let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
342 " Filter out possible color definitions
343 call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
344 " Filter out complex border definitions
345 call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
346 let templines = join(classlines, ' ')
347 let stylelines = split(templines)
348 let classlines = filter(stylelines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
349
350 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000351 endif
352 " We gathered classes definitions from all external files
353 let classes += classlines
354 endfor
355 if internal == 1
356 let classes += headclasslines
357 endif
Bram Moolenaar1e015462005-09-25 22:16:38 +0000358
359 if search_for == 'class'
360 let elements = {}
361 for element in classes
362 if element =~ '^\.'
363 let class = matchstr(element, '^\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
364 let class = substitute(class, ':.*', '', '')
365 if has_key(elements, 'common')
366 let elements['common'] .= ' '.class
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000367 else
Bram Moolenaar1e015462005-09-25 22:16:38 +0000368 let elements['common'] = class
369 endif
370 else
371 let class = matchstr(element, '[a-zA-Z1-6]*\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
372 let tagname = tolower(matchstr(element, '[a-zA-Z1-6]*\ze.'))
373 if tagname != ''
374 if has_key(elements, tagname)
375 let elements[tagname] .= ' '.class
376 else
377 let elements[tagname] = class
378 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000379 endif
380 endif
Bram Moolenaar1e015462005-09-25 22:16:38 +0000381 endfor
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000382
Bram Moolenaar1e015462005-09-25 22:16:38 +0000383 if has_key(elements, tag) && has_key(elements, 'common')
384 let values = split(elements[tag]." ".elements['common'])
385 elseif has_key(elements, tag) && !has_key(elements, 'common')
386 let values = split(elements[tag])
387 elseif !has_key(elements, tag) && has_key(elements, 'common')
388 let values = split(elements['common'])
389 else
390 return []
391 endif
392
393 elseif search_for == 'id'
394 " Find used IDs
395 " 1. Catch whole file
396 let filelines = getline(1, line('$'))
397 " 2. Find lines with possible id
398 let used_id_lines = filter(filelines, 'v:val =~ "id\\s*=\\s*[\"''][a-zA-Z0-9_-]\\+"')
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000399 " 3a. Join all filtered lines
Bram Moolenaar1e015462005-09-25 22:16:38 +0000400 let id_string = join(used_id_lines, ' ')
401 " 3b. And split them to be sure each id is in separate item
402 let id_list = split(id_string, 'id\s*=\s*')
403 " 4. Extract id values
404 let used_id = map(id_list, 'matchstr(v:val, "[\"'']\\zs[a-zA-Z0-9_-]\\+\\ze")')
405 let joined_used_id = ','.join(used_id, ',').','
406
407 let allvalues = map(classes, 'matchstr(v:val, ".*#\\zs[a-zA-Z0-9_-]\\+")')
408
409 let values = []
410
411 for element in classes
412 if joined_used_id !~ ','.element.','
413 let values += [element]
414 endif
415
416 endfor
417
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000418 endif
419
420 " We need special version of sbase
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000421 let classbase = matchstr(context, ".*[\"']")
Bram Moolenaar1e015462005-09-25 22:16:38 +0000422 let classquote = matchstr(classbase, '.$')
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000423
424 let entered_class = matchstr(attr, ".*=\\s*[\"']\\zs.*")
425
426 for m in sort(values)
427 if m =~? '^'.entered_class
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000428 call add(res, m . classquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000429 elseif m =~? entered_class
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000430 call add(res2, m . classquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000431 endif
432 endfor
433
434 return res + res2
435
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000436 elseif context =~? "style\\s*=\\s*[\"'][^\"']*$"
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000437 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000438
439 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000440 " }}}
441 " Complete on-events {{{
442 if context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
443 " We have to:
444 " 1. Find external files
445 let b:js_extfiles = []
446 let l = line('.')
447 let c = col('.')
448 call cursor(1,1)
449 while search('<\@<=script\>', 'W') && line('.') <= l
450 if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
451 let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
452 if filereadable(sname)
453 let b:js_extfiles += readfile(sname)
454 endif
455 endif
456 endwhile
457 " 2. Find at least one <script> tag
458 call cursor(1,1)
459 let js_scripttags = []
460 while search('<script\>', 'W') && line('.') < l
461 if matchstr(getline('.'), '<script[^>]*src') == ''
462 let js_scripttag = getline(line('.'), search('</script>', 'W'))
463 let js_scripttags += js_scripttag
464 endif
465 endwhile
466 let b:js_extfiles += js_scripttags
467
468 " 3. Proper call for javascriptcomplete#CompleteJS
469 call cursor(l,c)
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000470 let js_context = matchstr(a:base, '\k\+$')
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000471 let js_shortcontext = substitute(a:base, js_context.'$', '', '')
472 let b:compl_context = context
473 let b:jsrange = [l, l]
474 unlet! l c
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000475 return javascriptcomplete#CompleteJS(0, js_context)
476
477 endif
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000478
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000479 " }}}
480 let stripbase = matchstr(context, ".*\\(on[a-zA-Z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000481 " Now we have context stripped from all chars up to style/class.
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000482 " It may fail with some strange style value combinations.
483 if stripbase !~ "[\"']"
484 return []
485 endif
486 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000487 " Value of attribute completion {{{
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000488 " If attr contains =\s*[\"'] we catched value of attribute
Bram Moolenaar8424a622006-04-19 21:23:36 +0000489 if attr =~ "=\s*[\"']" || attr =~ "=\s*$"
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000490 " Let do attribute specific completion
491 let attrname = matchstr(attr, '.*\ze\s*=')
Bram Moolenaar8424a622006-04-19 21:23:36 +0000492 let entered_value = matchstr(attr, ".*=\\s*[\"']\\?\\zs.*")
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000493 let values = []
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000494 " Load data {{{
495 if !exists("b:html_doctype")
496 call htmlcomplete#CheckDoctype()
497 endif
498 if !exists("b:html_omni")
499 "runtime! autoload/xml/xhtml10s.vim
500 call htmlcomplete#LoadData()
501 endif
502 " }}}
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000503 if attrname == 'href'
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000504 " Now we are looking for local anchors defined by name or id
505 if entered_value =~ '^#'
506 let file = join(getline(1, line('$')), ' ')
507 " Split it be sure there will be one id/name element in
508 " item, it will be also first word [a-zA-Z0-9_-] in element
509 let oneelement = split(file, "\\(meta \\)\\@<!\\(name\\|id\\)\\s*=\\s*[\"']")
510 for i in oneelement
511 let values += ['#'.matchstr(i, "^[a-zA-Z][a-zA-Z0-9%_-]*")]
512 endfor
513 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000514 else
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000515 if has_key(b:html_omni, tag) && has_key(b:html_omni[tag][1], attrname)
516 let values = b:html_omni[tag][1][attrname]
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000517 else
518 return []
519 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000520 endif
521
522 if len(values) == 0
523 return []
524 endif
525
526 " We need special version of sbase
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000527 let attrbase = matchstr(context, ".*[\"']")
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000528 let attrquote = matchstr(attrbase, '.$')
Bram Moolenaar8424a622006-04-19 21:23:36 +0000529 if attrquote !~ "['\"]"
530 let attrquoteopen = '"'
531 let attrquote = '"'
532 else
533 let attrquoteopen = ''
534 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000535
536 for m in values
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000537 " This if is needed to not offer all completions as-is
538 " alphabetically but sort them. Those beginning with entered
539 " part will be as first choices
540 if m =~ '^'.entered_value
Bram Moolenaarf9393ef2006-04-24 19:47:27 +0000541 call add(res, attrquoteopen . m . attrquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000542 elseif m =~ entered_value
Bram Moolenaarf9393ef2006-04-24 19:47:27 +0000543 call add(res2, attrquoteopen . m . attrquote)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000544 endif
545 endfor
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000546
547 return res + res2
548
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000549 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000550 " }}}
551 " Attribute completion {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000552 " Shorten context to not include last word
553 let sbase = matchstr(context, '.*\ze\s.*')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000554
555 " Load data {{{
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000556 if !exists("b:html_doctype")
557 call htmlcomplete#CheckDoctype()
558 endif
559 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000560 call htmlcomplete#LoadData()
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000561 endif
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000562 " }}}
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000563
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000564 if has_key(b:html_omni, tag)
565 let attrs = keys(b:html_omni[tag][1])
Bram Moolenaar8424a622006-04-19 21:23:36 +0000566 else
567 return []
568 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000569
570 for m in sort(attrs)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000571 if m =~ '^'.attr
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000572 call add(res, m)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000573 elseif m =~ attr
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000574 call add(res2, m)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000575 endif
576 endfor
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000577 let menu = res + res2
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000578 if has_key(b:html_omni, 'vimxmlattrinfo')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000579 let final_menu = []
580 for i in range(len(menu))
581 let item = menu[i]
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000582 if has_key(b:html_omni['vimxmlattrinfo'], item)
583 let m_menu = b:html_omni['vimxmlattrinfo'][item][0]
584 let m_info = b:html_omni['vimxmlattrinfo'][item][1]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000585 else
586 let m_menu = ''
587 let m_info = ''
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000588 endif
589 if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
590 let item = item
591 let m_menu = 'Bool'
592 else
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000593 let item .= '="'
594 endif
595 let final_menu += [{'word':item, 'menu':m_menu, 'info':m_info}]
596 endfor
597 else
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000598 let final_menu = []
599 for i in range(len(menu))
600 let item = menu[i]
601 if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
602 let item = item
603 else
604 let item .= '="'
605 endif
606 let final_menu += [item]
607 endfor
608 return final_menu
609
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000610 endif
611 return final_menu
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000612
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000613 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000614 " }}}
615 " Close tag {{{
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000616 let b:unaryTagsStack = "base meta link hr br param img area input col"
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000617 if context =~ '^\/'
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000618 if context =~ '^\/.'
619 return []
620 else
621 let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
622 return [opentag.">"]
623 endif
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000624 endif
Bram Moolenaar8424a622006-04-19 21:23:36 +0000625 " }}}
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000626 " Load data {{{
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000627 if !exists("b:html_doctype")
628 call htmlcomplete#CheckDoctype()
629 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000630 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000631 "runtime! autoload/xml/xhtml10s.vim
632 call htmlcomplete#LoadData()
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000633 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000634 " }}}
635 " Tag completion {{{
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000636 " Deal with tag completion.
Bram Moolenaar8424a622006-04-19 21:23:36 +0000637 let opentag = tolower(xmlcomplete#GetLastOpenTag("b:unaryTagsStack"))
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000638 " MM: TODO: GLOT works always the same but with some weird situation it
639 " behaves as intended in HTML but screws in PHP
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000640 if opentag == '' || &filetype == 'php' && !has_key(b:html_omni, opentag)
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000641 " Hack for sometimes failing GetLastOpenTag.
642 " As far as I tested fail isn't GLOT fault but problem
643 " of invalid document - not properly closed tags and other mish-mash.
644 " Also when document is empty. Return list of *all* tags.
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000645 let tags = keys(b:html_omni)
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000646 call filter(tags, 'v:val !~ "^vimxml"')
647 else
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000648 if has_key(b:html_omni, opentag)
649 let tags = b:html_omni[opentag][0]
Bram Moolenaar8424a622006-04-19 21:23:36 +0000650 else
651 return []
652 endif
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000653 endif
654 " }}}
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000655
Bram Moolenaar8424a622006-04-19 21:23:36 +0000656 if exists("uppercase_tag") && uppercase_tag == 1
657 let context = tolower(context)
658 endif
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000659 " Handle XML keywords: DOCTYPE
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000660 if opentag == ''
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000661 let tags += [
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000662 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',
663 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">',
664 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">',
665 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">',
666 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
667 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
668 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
669 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
670 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
671 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
672 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/1999/xhtml">'
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000673 \ ]
674 endif
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000675
Bram Moolenaarcef9dcc2005-12-06 19:50:41 +0000676 for m in sort(tags)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000677 if m =~ '^'.context
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000678 call add(res, m)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000679 elseif m =~ context
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000680 call add(res2, m)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000681 endif
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000682 endfor
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000683 let menu = res + res2
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000684 if has_key(b:html_omni, 'vimxmltaginfo')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000685 let final_menu = []
686 for i in range(len(menu))
687 let item = menu[i]
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000688 if has_key(b:html_omni['vimxmltaginfo'], item)
689 let m_menu = b:html_omni['vimxmltaginfo'][item][0]
690 let m_info = b:html_omni['vimxmltaginfo'][item][1]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000691 else
692 let m_menu = ''
693 let m_info = ''
694 endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000695 if &filetype == 'html' && exists("uppercase_tag") && uppercase_tag == 1 && item !~ 'DOCTYPE'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000696 let item = toupper(item)
697 endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000698 if item =~ 'DOCTYPE'
699 let abbr = 'DOCTYPE '.matchstr(item, 'DTD \zsX\?HTML .\{-}\ze\/\/')
700 else
701 let abbr = item
702 endif
703 let final_menu += [{'abbr':abbr, 'word':item, 'menu':m_menu, 'info':m_info}]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000704 endfor
705 else
706 let final_menu = menu
707 endif
708 return final_menu
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000709
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000710 " }}}
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000711 endif
712endfunction
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000713
714function! htmlcomplete#LoadData() " {{{
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000715 if !exists("b:html_omni_flavor")
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000716 if &filetype == 'html'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000717 let b:html_omni_flavor = 'html401t'
718 else
719 let b:html_omni_flavor = 'xhtml10s'
720 endif
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000721 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000722 " With that if we still have bloated memory but create new buffer
723 " variables only by linking to existing g:variable, not sourcing whole
724 " file.
725 if exists('g:xmldata_'.b:html_omni_flavor)
726 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
727 else
728 exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000729 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000730 endif
731endfunction
732" }}}
733function! htmlcomplete#CheckDoctype() " {{{
734 if exists('b:html_omni_flavor')
735 let old_flavor = b:html_omni_flavor
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000736 else
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000737 let old_flavor = ''
738 endif
739 let i = 1
740 while i < 10 && i < line("$")
741 let line = getline(i)
742 if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
743 let b:html_omni_flavor = 'html32'
744 let b:html_doctype = 1
745 break
746 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
747 let b:html_omni_flavor = 'html40t'
748 let b:html_doctype = 1
749 break
750 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
751 let b:html_omni_flavor = 'html40f'
752 let b:html_doctype = 1
753 break
754 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
755 let b:html_omni_flavor = 'html40s'
756 let b:html_doctype = 1
757 break
758 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
759 let b:html_omni_flavor = 'html401t'
760 let b:html_doctype = 1
761 break
762 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
763 let b:html_omni_flavor = 'html401f'
764 let b:html_doctype = 1
765 break
766 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
767 let b:html_omni_flavor = 'html401s'
768 let b:html_doctype = 1
769 break
770 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
771 let b:html_omni_flavor = 'xhtml10t'
772 let b:html_doctype = 1
773 break
774 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
775 let b:html_omni_flavor = 'xhtml10f'
776 let b:html_doctype = 1
777 break
778 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
779 let b:html_omni_flavor = 'xhtml10s'
780 let b:html_doctype = 1
781 break
782 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
783 let b:html_omni_flavor = 'xhtml11'
784 let b:html_doctype = 1
785 break
786 endif
787 let i += 1
788 endwhile
789 if !exists("b:html_doctype")
790 return
791 else
792 " Tie g:xmldata with b:html_omni this way we need to sourca data file only
793 " once, not every time per buffer.
794 if old_flavor == b:html_omni_flavor
795 return
796 else
797 if exists('g:xmldata_'.b:html_omni_flavor)
798 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
799 else
800 exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
801 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
802 endif
803 return
804 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000805 endif
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000806endfunction
807" }}}
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000808" vim:set foldmethod=marker: