html.vim 1.9 KB

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