robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:5eb10c5: runtime(xml): update XML runtime files8eba81182a

master
2.2 KiB66 linesraw
1" Vim filetype plugin file
2"     Language:	xml
3"   Maintainer:	Christian Brabandt <cb@256bit.org>
4" Last Changed:	2024 May 24
5"   Repository:	https://github.com/chrisbra/vim-xml-ftplugin
6" Previously
7"    Maintainer:	Dan Sharp <dwsharp at users dot sourceforge dot net>
8"    URL:		http://dwsharp.users.sourceforge.net/vim/ftplugin
9
10if exists("b:did_ftplugin") | finish | endif
11let b:did_ftplugin = 1
12
13" Make sure the continuation lines below do not cause problems in
14" compatibility mode.
15let s:save_cpo = &cpo
16set cpo&vim
17
18setlocal commentstring=<!--\ %s\ -->
19" Remove the middlepart from the comments section, as this causes problems:
20" https://groups.google.com/d/msg/vim_dev/x4GT-nqa0Kg/jvtRnEbtAnMJ
21setlocal comments=s:<!--,e:-->
22
23setlocal formatoptions-=t
24setlocal formatoptions+=croql
25setlocal formatexpr=xmlformat#Format()
26
27" XML:  thanks to Johannes Zellner and Akbar Ibrahim
28" - case sensitive
29" - don't match empty tags <fred/>
30" - match <!--, --> style comments (but not --, --)
31" - match <!, > inlined dtd's. This is not perfect, as it
32"   gets confused for example by
33"       <!ENTITY gt ">">
34if exists("loaded_matchit")
35    let b:match_ignorecase=0
36    let b:match_words =
37     \  '<:>,' .
38     \  '<\@<=!\[CDATA\[:]]>,'.
39     \  '<\@<=!--:-->,'.
40     \  '<\@<=?\k\+:?>,'.
41     \  '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'.
42     \  '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'
43endif
44
45" For Omni completion, by Mikolaj Machowski.
46if exists('&ofu')
47  setlocal ofu=xmlcomplete#CompleteTags
48endif
49command! -nargs=+ XMLns call xmlcomplete#CreateConnection(<f-args>)
50command! -nargs=? XMLent call xmlcomplete#CreateEntConnection(<f-args>)
51
52" Change the :browse e filter to primarily show xml-related files.
53if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
54    let  b:browsefilter="XML Files (*.xml)\t*.xml\n" .
55    \ "DTD Files (*.dtd)\t*.dtd\n" .
56    \ "XSD Files (*.xsd)\t*.xsd\n" .
57    \ "All Files (*.*)\t*.*\n"
58endif
59
60" Undo the stuff we changed.
61let b:undo_ftplugin = "setlocal commentstring< comments< formatoptions< formatexpr< " .
62    \     " | unlet! b:match_ignorecase b:match_words b:browsefilter"
63
64" Restore the saved compatibility options.
65let &cpo = s:save_cpo
66unlet s:save_cpo