html.vim 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. " Vim filetype plugin file
  2. " Language: HTML
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Dan Sharp
  5. " Last Changed: 2022 Jul 20
  6. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let s:save_cpo = &cpo
  11. set cpo-=C
  12. setlocal matchpairs+=<:>
  13. setlocal commentstring=<!--%s-->
  14. setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
  15. let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
  16. if get(g:, "ft_html_autocomment", 0)
  17. setlocal formatoptions-=t formatoptions+=croql
  18. let b:undo_ftplugin ..= " | setlocal formatoptions<"
  19. endif
  20. if exists('&omnifunc')
  21. setlocal omnifunc=htmlcomplete#CompleteTags
  22. call htmlcomplete#DetectOmniFlavor()
  23. let b:undo_ftplugin ..= " | setlocal omnifunc<"
  24. endif
  25. " HTML: thanks to Johannes Zellner and Benji Fisher.
  26. if exists("loaded_matchit") && !exists("b:match_words")
  27. let b:match_ignorecase = 1
  28. let b:match_words = '<!--:-->,' ..
  29. \ '<:>,' ..
  30. \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
  31. \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
  32. \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
  33. let b:html_set_match_words = 1
  34. let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
  35. endif
  36. " Change the :browse e filter to primarily show HTML-related files.
  37. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  38. let b:browsefilter = "HTML Files (*.html *.htm)\t*.htm;*.html\n" ..
  39. \ "JavaScript Files (*.js)\t*.js\n" ..
  40. \ "Cascading StyleSheets (*.css)\t*.css\n" ..
  41. \ "All Files (*.*)\t*.*\n"
  42. let b:html_set_browsefilter = 1
  43. let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
  44. endif
  45. let &cpo = s:save_cpo
  46. unlet s:save_cpo