Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: html |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
| 7 | if exists("b:did_ftplugin") | finish | endif |
| 8 | let b:did_ftplugin = 1 |
| 9 | |
| 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 | |
Bram Moolenaar | a7241f5 | 2008-06-24 20:39:31 +0000 | [diff] [blame] | 15 | setlocal matchpairs+=<:> |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 16 | setlocal commentstring=<!--%s--> |
| 17 | setlocal comments=s:<!--,m:\ \ \ \ ,e:--> |
| 18 | |
| 19 | if exists("g:ft_html_autocomment") && (g:ft_html_autocomment == 1) |
| 20 | setlocal formatoptions-=t formatoptions+=croql |
| 21 | endif |
| 22 | |
Bram Moolenaar | f193fff | 2006-04-27 00:02:13 +0000 | [diff] [blame] | 23 | if exists('&omnifunc') |
Bram Moolenaar | 946e27a | 2014-06-25 18:50:27 +0200 | [diff] [blame] | 24 | setlocal omnifunc=htmlcomplete#CompleteTags |
| 25 | call htmlcomplete#DetectOmniFlavor() |
Bram Moolenaar | f193fff | 2006-04-27 00:02:13 +0000 | [diff] [blame] | 26 | endif |
Bram Moolenaar | 4a85b41 | 2006-04-23 22:40:29 +0000 | [diff] [blame] | 27 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | " HTML: thanks to Johannes Zellner and Benji Fisher. |
| 29 | if exists("loaded_matchit") |
| 30 | let b:match_ignorecase = 1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | let b:match_words = '<:>,' . |
| 32 | \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . |
| 33 | \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . |
| 34 | \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' |
| 35 | endif |
| 36 | |
| 37 | " Change the :browse e filter to primarily show HTML-related files. |
| 38 | if has("gui_win32") |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 39 | let b:browsefilter="HTML Files (*.html,*.htm)\t*.htm;*.html\n" . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | \ "JavaScript Files (*.js)\t*.js\n" . |
| 41 | \ "Cascading StyleSheets (*.css)\t*.css\n" . |
| 42 | \ "All Files (*.*)\t*.*\n" |
| 43 | endif |
| 44 | |
| 45 | " Undo the stuff we changed. |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 46 | let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<" . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 47 | \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter" |
| 48 | |
| 49 | " Restore the saved compatibility options. |
| 50 | let &cpo = s:save_cpo |
Bram Moolenaar | 84f7235 | 2012-03-11 15:57:40 +0100 | [diff] [blame] | 51 | unlet s:save_cpo |