annotate runtime/ftplugin/html.vim @ 1428:912b18745def v7.1.143

updated for version 7.1-143
author vimboss
date Fri, 19 Oct 2007 15:33:39 +0000
parents d3bbb5dd3913
children b9740fb41986
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: html
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Dan Sharp <dwsharp at hotmail dot com>
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
4 " Last Changed: 2006 Apr 26
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_ftplugin") | finish | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Make sure the continuation lines below do not cause problems in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " compatibility mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let s:save_cpo = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 set cpo-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 setlocal commentstring=<!--%s-->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
17 if exists('&omnifunc')
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
18 " Distinguish between HTML versions
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
19 " To use with other HTML versions add another
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
20 " elseif condition to match proper DOCTYPE
523
a7ae7e043e43 updated for version 7.0146
vimboss
parents: 15
diff changeset
21 setlocal omnifunc=htmlcomplete#CompleteTags
a7ae7e043e43 updated for version 7.0146
vimboss
parents: 15
diff changeset
22
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
23 if &filetype == 'xhtml'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
24 let b:html_omni_flavor = 'xhtml10s'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
25 else
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
26 let b:html_omni_flavor = 'html401t'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
27 endif
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
28 let i = 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
29 while i < 10 && i < line("$")
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
30 let line = getline(i)
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
31 if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
32 let b:html_omni_flavor = 'html32'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
33 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
34 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
35 let b:html_omni_flavor = 'html40t'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
36 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
37 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
38 let b:html_omni_flavor = 'html40f'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
39 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
40 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
41 let b:html_omni_flavor = 'html40s'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
42 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
43 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
44 let b:html_omni_flavor = 'html401t'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
45 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
46 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
47 let b:html_omni_flavor = 'html401f'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
48 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
49 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
50 let b:html_omni_flavor = 'html401s'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
51 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
52 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
53 let b:html_omni_flavor = 'xhtml10t'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
54 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
55 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
56 let b:html_omni_flavor = 'xhtml10f'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
57 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
58 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
59 let b:html_omni_flavor = 'xhtml10s'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
60 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
61 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
62 let b:html_omni_flavor = 'xhtml11'
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
63 break
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
64 endif
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
65 let i += 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
66 endwhile
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
67 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
68
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " HTML: thanks to Johannes Zellner and Benji Fisher.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 if exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 let b:match_ignorecase = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 let b:match_skip = 's:Comment'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 let b:match_words = '<:>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " Change the :browse e filter to primarily show HTML-related files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 if has("gui_win32")
15
631143ac4a01 updated for version 7.0007
vimboss
parents: 7
diff changeset
81 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 \ "JavaScript Files (*.js)\t*.js\n" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 \ "Cascading StyleSheets (*.css)\t*.css\n" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 \ "All Files (*.*)\t*.*\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " Undo the stuff we changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let b:undo_ftplugin = "setlocal commentstring<"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " Restore the saved compatibility options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let &cpo = s:save_cpo