blob: 3179aa2e88c047b5847108b9f09b7eaa0d4a6cef [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: html
Bram Moolenaar1588bc82022-03-08 21:35:07 +00003"
4" This runtime file is looking for a new maintainer.
5"
6" Former maintainer: Dan Sharp
Bram Moolenaar5c736222010-01-06 20:54:52 +01007" Last Changed: 20 Jan 2009
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9if exists("b:did_ftplugin") | finish | endif
10let b:did_ftplugin = 1
11
12" Make sure the continuation lines below do not cause problems in
13" compatibility mode.
14let s:save_cpo = &cpo
15set cpo-=C
16
Bram Moolenaara7241f52008-06-24 20:39:31 +000017setlocal matchpairs+=<:>
Bram Moolenaare37d50a2008-08-06 17:06:04 +000018setlocal commentstring=<!--%s-->
19setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
20
21if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1)
22 setlocal formatoptions-=t formatoptions+=croql
23endif
24
Bram Moolenaarf193fff2006-04-27 00:02:13 +000025if exists('&omnifunc')
Bram Moolenaar946e27a2014-06-25 18:50:27 +020026 setlocal omnifunc=htmlcomplete#CompleteTags
27 call htmlcomplete#DetectOmniFlavor()
Bram Moolenaarf193fff2006-04-27 00:02:13 +000028endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +000029
Bram Moolenaar071d4272004-06-13 20:20:40 +000030" HTML: thanks to Johannes Zellner and Benji Fisher.
31if exists("loaded_matchit")
32 let b:match_ignorecase = 1
Bram Moolenaar071d4272004-06-13 20:20:40 +000033 let b:match_words = '<:>,' .
34 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
35 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
36 \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
37endif
38
39" Change the :browse e filter to primarily show HTML-related files.
40if has("gui_win32")
Bram Moolenaar8299df92004-07-10 09:47:34 +000041 let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000042 \ "JavaScript Files (*.js)\t*.js\n" .
43 \ "Cascading StyleSheets (*.css)\t*.css\n" .
44 \ "All Files (*.*)\t*.*\n"
45endif
46
47" Undo the stuff we changed.
Bram Moolenaare37d50a2008-08-06 17:06:04 +000048let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000049 \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
50
51" Restore the saved compatibility options.
52let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010053unlet s:save_cpo