1 " Vim filetype plugin file
3 " Maintainer: Dan Sharp <dwsharp at hotmail dot com>
4 " Last Changed: 2007 Nov 20
5 " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin
7 if exists("b:did_ftplugin") | finish | endif
10 " Make sure the continuation lines below do not cause problems in
15 setlocal commentstring=<!--%s-->
16 setlocal matchpairs+=<:>
18 if exists('&omnifunc')
19 " Distinguish between HTML versions
20 " To use with other HTML versions add another
21 " elseif condition to match proper DOCTYPE
22 setlocal omnifunc=htmlcomplete#CompleteTags
24 if &filetype == 'xhtml'
25 let b:html_omni_flavor = 'xhtml10s'
27 let b:html_omni_flavor = 'html401t'
31 while i < 10 && i < line("$")
33 if line =~ '<!DOCTYPE.*\<DTD '
38 if line =~ '<!DOCTYPE.*\<DTD ' " doctype line found above
39 if line =~ ' HTML 3\.2'
40 let b:html_omni_flavor = 'html32'
41 elseif line =~ ' XHTML 1\.1'
42 let b:html_omni_flavor = 'xhtml11'
43 else " two-step detection with strict/frameset/transitional
44 if line =~ ' XHTML 1\.0'
45 let b:html_omni_flavor = 'xhtml10'
46 elseif line =~ ' HTML 4\.01'
47 let b:html_omni_flavor = 'html401'
48 elseif line =~ ' HTML 4.0\>'
49 let b:html_omni_flavor = 'html40'
51 if line =~ '\<Transitional\>'
52 let b:html_omni_flavor .= 't'
53 elseif line =~ '\<Frameset\>'
54 let b:html_omni_flavor .= 'f'
56 let b:html_omni_flavor .= 's'
62 " HTML: thanks to Johannes Zellner and Benji Fisher.
63 if exists("loaded_matchit")
64 let b:match_ignorecase = 1
65 let b:match_words = '<:>,' .
66 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
67 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
68 \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
71 " Change the :browse e filter to primarily show HTML-related files.
73 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
74 \ "JavaScript Files (*.js)\t*.js\n" .
75 \ "Cascading StyleSheets (*.css)\t*.css\n" .
76 \ "All Files (*.*)\t*.*\n"
79 " Undo the stuff we changed.
80 let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc<"
81 \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
83 " Restore the saved compatibility options.