blob: 5495f859de48d1597c524b2a310badca8ec521c7 [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
Doug Kearns93197fd2024-01-14 20:59:02 +01005" Last Change: 2024 Jan 14
Riley Bruins0a083062024-06-03 20:40:45 +02006" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
Bram Moolenaarb529cfb2022-07-25 15:42:07 +01008if exists("b:did_ftplugin")
9 finish
10endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000011let b:did_ftplugin = 1
12
Bram Moolenaar071d4272004-06-13 20:20:40 +000013let s:save_cpo = &cpo
14set cpo-=C
15
Bram Moolenaara7241f52008-06-24 20:39:31 +000016setlocal matchpairs+=<:>
Riley Bruins0a083062024-06-03 20:40:45 +020017setlocal commentstring=<!--\ %s\ -->
Bram Moolenaare37d50a2008-08-06 17:06:04 +000018setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
19
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010020let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
21
22if get(g:, "ft_html_autocomment", 0)
23 setlocal formatoptions-=t formatoptions+=croql
24 let b:undo_ftplugin ..= " | setlocal formatoptions<"
Bram Moolenaare37d50a2008-08-06 17:06:04 +000025endif
26
Bram Moolenaarf193fff2006-04-27 00:02:13 +000027if exists('&omnifunc')
Bram Moolenaar946e27a2014-06-25 18:50:27 +020028 setlocal omnifunc=htmlcomplete#CompleteTags
29 call htmlcomplete#DetectOmniFlavor()
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010030 let b:undo_ftplugin ..= " | setlocal omnifunc<"
Bram Moolenaarf193fff2006-04-27 00:02:13 +000031endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +000032
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010033" HTML: thanks to Johannes Zellner and Benji Fisher.
34if exists("loaded_matchit") && !exists("b:match_words")
35 let b:match_ignorecase = 1
36 let b:match_words = '<!--:-->,' ..
37 \ '<:>,' ..
38 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
39 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
40 \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
41 let b:html_set_match_words = 1
42 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
Bram Moolenaar071d4272004-06-13 20:20:40 +000043endif
44
45" Change the :browse e filter to primarily show HTML-related files.
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010046if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
Doug Kearns93197fd2024-01-14 20:59:02 +010047 let b:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010048 \ "JavaScript Files (*.js)\t*.js\n" ..
Doug Kearns93197fd2024-01-14 20:59:02 +010049 \ "Cascading StyleSheets (*.css)\t*.css\n"
50 if has("win32")
51 let b:browsefilter ..= "All Files (*.*)\t*\n"
52 else
53 let b:browsefilter ..= "All Files (*)\t*\n"
54 endif
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010055 let b:html_set_browsefilter = 1
56 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
Bram Moolenaar071d4272004-06-13 20:20:40 +000057endif
58
Bram Moolenaar071d4272004-06-13 20:20:40 +000059let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010060unlet s:save_cpo