html.vim 1.6 KB

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