7
|
1 " Vim filetype plugin file
|
|
2 " Language: html
|
|
3 " Maintainer: Dan Sharp <dwsharp at hotmail dot com>
|
844
|
4 " Last Changed: 2006 Apr 26
|
7
|
5 " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin
|
|
6
|
|
7 if exists("b:did_ftplugin") | finish | endif
|
|
8 let b:did_ftplugin = 1
|
|
9
|
|
10 " Make sure the continuation lines below do not cause problems in
|
|
11 " compatibility mode.
|
|
12 let s:save_cpo = &cpo
|
|
13 set cpo-=C
|
|
14
|
|
15 setlocal commentstring=<!--%s-->
|
|
16
|
844
|
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
|
523
|
21 setlocal omnifunc=htmlcomplete#CompleteTags
|
|
22
|
841
|
23 if &filetype == 'xhtml'
|
|
24 let b:html_omni_flavor = 'xhtml10s'
|
|
25 else
|
|
26 let b:html_omni_flavor = 'html401t'
|
|
27 endif
|
|
28 let i = 1
|
|
29 while i < 10 && i < line("$")
|
|
30 let line = getline(i)
|
|
31 if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
|
|
32 let b:html_omni_flavor = 'html32'
|
|
33 break
|
|
34 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
|
|
35 let b:html_omni_flavor = 'html40t'
|
|
36 break
|
|
37 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
|
|
38 let b:html_omni_flavor = 'html40f'
|
|
39 break
|
|
40 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
|
|
41 let b:html_omni_flavor = 'html40s'
|
|
42 break
|
|
43 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
|
|
44 let b:html_omni_flavor = 'html401t'
|
|
45 break
|
|
46 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
|
|
47 let b:html_omni_flavor = 'html401f'
|
|
48 break
|
|
49 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
|
|
50 let b:html_omni_flavor = 'html401s'
|
|
51 break
|
|
52 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
|
|
53 let b:html_omni_flavor = 'xhtml10t'
|
|
54 break
|
|
55 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
|
|
56 let b:html_omni_flavor = 'xhtml10f'
|
|
57 break
|
|
58 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
|
|
59 let b:html_omni_flavor = 'xhtml10s'
|
|
60 break
|
|
61 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
|
|
62 let b:html_omni_flavor = 'xhtml11'
|
|
63 break
|
|
64 endif
|
|
65 let i += 1
|
|
66 endwhile
|
844
|
67 endif
|
841
|
68
|
7
|
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>'
|
|
77 endif
|
|
78
|
|
79 " Change the :browse e filter to primarily show HTML-related files.
|
|
80 if has("gui_win32")
|
15
|
81 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
|
7
|
82 \ "JavaScript Files (*.js)\t*.js\n" .
|
|
83 \ "Cascading StyleSheets (*.css)\t*.css\n" .
|
|
84 \ "All Files (*.*)\t*.*\n"
|
|
85 endif
|
|
86
|
|
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"
|
|
90
|
|
91 " Restore the saved compatibility options.
|
|
92 let &cpo = s:save_cpo
|