Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: xml |
| 3 | " Maintainer: Dan Sharp <dwsharp at hotmail dot com> |
| 4 | " Last Changed: 2003 Sep 29 |
| 5 | " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin |
| 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 | |
| 15 | setlocal commentstring=<!--%s--> |
| 16 | |
| 17 | " XML: thanks to Johannes Zellner and Akbar Ibrahim |
| 18 | " - case sensitive |
| 19 | " - don't match empty tags <fred/> |
| 20 | " - match <!--, --> style comments (but not --, --) |
| 21 | " - match <!, > inlined dtd's. This is not perfect, as it |
| 22 | " gets confused for example by |
| 23 | " <!ENTITY gt ">"> |
| 24 | if exists("loaded_matchit") |
| 25 | let b:match_ignorecase=0 |
| 26 | let b:match_words = |
| 27 | \ '<:>,' . |
| 28 | \ '<\@<=!\[CDATA\[:]]>,'. |
| 29 | \ '<\@<=!--:-->,'. |
| 30 | \ '<\@<=?\k\+:?>,'. |
| 31 | \ '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'. |
| 32 | \ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' |
| 33 | endif |
| 34 | |
| 35 | " Change the :browse e filter to primarily show xml-related files. |
| 36 | if has("gui_win32") |
| 37 | let b:browsefilter="XML Files (*.xml)\t*.xml\n" . |
| 38 | \ "DTD Files (*.dtd)\t*.dtd\n" . |
| 39 | \ "All Files (*.*)\t*.*\n" |
| 40 | endif |
| 41 | |
| 42 | " Undo the stuff we changed. |
| 43 | let b:undo_ftplugin = "setlocal cms<" . |
| 44 | \ " | unlet! b:match_ignorecase b:match_words b:browsefilter" |
| 45 | |
| 46 | " Restore the saved compatibility options. |
| 47 | let &cpo = s:save_cpo |