blob: 94cb62653fd35cdc5d88316692a24cc8da8f9a46 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaarb529cfb2022-07-25 15:42:07 +01002" Language: HTML
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
4" Previous Maintainer: Dan Sharp
5" Last Changed: 2022 Jul 20
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Bram Moolenaarb529cfb2022-07-25 15:42:07 +01007if exists("b:did_ftplugin")
8 finish
9endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000010let b:did_ftplugin = 1
11
Bram Moolenaar071d4272004-06-13 20:20:40 +000012let 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
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010019let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
20
21if get(g:, "ft_html_autocomment", 0)
22 setlocal formatoptions-=t formatoptions+=croql
23 let b:undo_ftplugin ..= " | setlocal formatoptions<"
Bram Moolenaare37d50a2008-08-06 17:06:04 +000024endif
25
Bram Moolenaarf193fff2006-04-27 00:02:13 +000026if exists('&omnifunc')
Bram Moolenaar946e27a2014-06-25 18:50:27 +020027 setlocal omnifunc=htmlcomplete#CompleteTags
28 call htmlcomplete#DetectOmniFlavor()
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010029 let b:undo_ftplugin ..= " | setlocal omnifunc<"
Bram Moolenaarf193fff2006-04-27 00:02:13 +000030endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +000031
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010032" HTML: thanks to Johannes Zellner and Benji Fisher.
33if exists("loaded_matchit") && !exists("b:match_words")
34 let b:match_ignorecase = 1
35 let b:match_words = '<!--:-->,' ..
36 \ '<:>,' ..
37 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
38 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
39 \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
40 let b:html_set_match_words = 1
41 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
Bram Moolenaar071d4272004-06-13 20:20:40 +000042endif
43
44" Change the :browse e filter to primarily show HTML-related files.
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010045if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
46 let b:browsefilter = "HTML Files (*.html *.htm)\t*.htm;*.html\n" ..
47 \ "JavaScript Files (*.js)\t*.js\n" ..
48 \ "Cascading StyleSheets (*.css)\t*.css\n" ..
49 \ "All Files (*.*)\t*.*\n"
50 let b:html_set_browsefilter = 1
51 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
Bram Moolenaar071d4272004-06-13 20:20:40 +000052endif
53
Bram Moolenaar071d4272004-06-13 20:20:40 +000054let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010055unlet s:save_cpo