blob: 7579080ea565807b00d217210e32e01ddcf4c2b5 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: html
Bram Moolenaar5c736222010-01-06 20:54:52 +01003" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
4" Last Changed: 20 Jan 2009
5" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7if exists("b:did_ftplugin") | finish | endif
8let b:did_ftplugin = 1
9
10" Make sure the continuation lines below do not cause problems in
11" compatibility mode.
12let s:save_cpo = &cpo
13set cpo-=C
14
Bram Moolenaara7241f52008-06-24 20:39:31 +000015setlocal matchpairs+=<:>
Bram Moolenaare37d50a2008-08-06 17:06:04 +000016setlocal commentstring=<!--%s-->
17setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
18
19if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1)
20 setlocal formatoptions-=t formatoptions+=croql
21endif
22
Bram Moolenaarf193fff2006-04-27 00:02:13 +000023if exists('&omnifunc')
Bram Moolenaar946e27a2014-06-25 18:50:27 +020024 setlocal omnifunc=htmlcomplete#CompleteTags
25 call htmlcomplete#DetectOmniFlavor()
Bram Moolenaarf193fff2006-04-27 00:02:13 +000026endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +000027
Bram Moolenaar071d4272004-06-13 20:20:40 +000028" HTML: thanks to Johannes Zellner and Benji Fisher.
29if exists("loaded_matchit")
30 let b:match_ignorecase = 1
Bram Moolenaar071d4272004-06-13 20:20:40 +000031 let b:match_words = '<:>,' .
32 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
33 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
34 \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
35endif
36
37" Change the :browse e filter to primarily show HTML-related files.
38if has("gui_win32")
Bram Moolenaar8299df92004-07-10 09:47:34 +000039 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000040 \ "JavaScript Files (*.js)\t*.js\n" .
41 \ "Cascading StyleSheets (*.css)\t*.css\n" .
42 \ "All Files (*.*)\t*.*\n"
43endif
44
45" Undo the stuff we changed.
Bram Moolenaare37d50a2008-08-06 17:06:04 +000046let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000047 \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
48
49" Restore the saved compatibility options.
50let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010051unlet s:save_cpo