1 " Vim filetype plugin file
3 " Maintainer: Dan Sharp <dwsharp at hotmail dot com>
4 " Last Changed: 2006 Apr 26
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-->
17 if exists('&omnifunc')
18 " Distinguish between HTML versions
19 " To use with other HTML versions add another
20 " elseif condition to match proper DOCTYPE
21 setlocal omnifunc=htmlcomplete#CompleteTags
23 if &filetype == 'xhtml'
24 let b:html_omni_flavor = 'xhtml10s'
26 let b:html_omni_flavor = 'html401t'
29 while i < 10 && i < line("$")
31 if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
32 let b:html_omni_flavor = 'html32'
34 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
35 let b:html_omni_flavor = 'html40t'
37 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
38 let b:html_omni_flavor = 'html40f'
40 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
41 let b:html_omni_flavor = 'html40s'
43 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
44 let b:html_omni_flavor = 'html401t'
46 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
47 let b:html_omni_flavor = 'html401f'
49 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
50 let b:html_omni_flavor = 'html401s'
52 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
53 let b:html_omni_flavor = 'xhtml10t'
55 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
56 let b:html_omni_flavor = 'xhtml10f'
58 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
59 let b:html_omni_flavor = 'xhtml10s'
61 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
62 let b:html_omni_flavor = 'xhtml11'
69 " HTML: thanks to Johannes Zellner and Benji Fisher.
70 if exists("loaded_matchit")
71 let b:match_ignorecase = 1
72 let b:match_skip = 's:Comment'
73 let b:match_words = '<:>,' .
74 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
75 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
76 \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
79 " Change the :browse e filter to primarily show HTML-related files.
81 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
82 \ "JavaScript Files (*.js)\t*.js\n" .
83 \ "Cascading StyleSheets (*.css)\t*.css\n" .
84 \ "All Files (*.*)\t*.*\n"
87 " Undo the stuff we changed.
88 let b:undo_ftplugin = "setlocal commentstring<"
89 \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
91 " Restore the saved compatibility options.