html.vim 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. " Vim filetype plugin file
  2. " Language: html
  3. "
  4. " This runtime file is looking for a new maintainer.
  5. "
  6. " Former maintainer: Dan Sharp
  7. " Last Changed: 20 Jan 2009
  8. if exists("b:did_ftplugin") | finish | endif
  9. let b:did_ftplugin = 1
  10. " Make sure the continuation lines below do not cause problems in
  11. " compatibility mode.
  12. let s:save_cpo = &cpo
  13. set cpo-=C
  14. setlocal matchpairs+=<:>
  15. setlocal commentstring=<!--%s-->
  16. setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
  17. if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1)
  18. setlocal formatoptions-=t formatoptions+=croql
  19. endif
  20. if exists('&omnifunc')
  21. setlocal omnifunc=htmlcomplete#CompleteTags
  22. call htmlcomplete#DetectOmniFlavor()
  23. endif
  24. " HTML: thanks to Johannes Zellner and Benji Fisher.
  25. if exists("loaded_matchit")
  26. let b:match_ignorecase = 1
  27. let b:match_words = '<:>,' .
  28. \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
  29. \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
  30. \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
  31. endif
  32. " Change the :browse e filter to primarily show HTML-related files.
  33. if has("gui_win32")
  34. let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" .
  35. \ "JavaScript Files (*.js)\t*.js\n" .
  36. \ "Cascading StyleSheets (*.css)\t*.css\n" .
  37. \ "All Files (*.*)\t*.*\n"
  38. endif
  39. " Undo the stuff we changed.
  40. let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" .
  41. \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter"
  42. " Restore the saved compatibility options.
  43. let &cpo = s:save_cpo
  44. unlet s:save_cpo