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