annotate runtime/syntax/xml.vim @ 26007:1d2e1c23e458 v8.2.3537

patch 8.2.3537: mode() does not return the right value in 'operatorfunc' Commit: https://github.com/vim/vim/commit/75c30e96cf280a8cc01ac01c41a9252db3e503cc Author: naohiro ono <obcat@icloud.com> Date: Tue Oct 19 11:15:41 2021 +0100 patch 8.2.3537: mode() does not return the right value in 'operatorfunc' Problem: mode() does not return the right value in 'operatorfunc'. Solution: Reset finish_op while calling 'operatorfunc'.
author Bram Moolenaar <Bram@vim.org>
date Tue, 19 Oct 2021 12:30:05 +0200
parents 8dde7ced3344
children f0d7cb510ce3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
2 " Language: XML
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
3 " Maintainer: Christian Brabandt <cb@256bit.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
4 " Repository: https://github.com/chrisbra/vim-xml-ftplugin
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
5 " Previous Maintainer: Johannes Zellner <johannes@zellner.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
6 " Author: Paul Siegmann <pauls@euronet.nl>
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
7 " Last Changed: Nov 03, 2019
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Filenames: *.xml
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
9 " Last Change:
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
10 " 20190923 - Fix xmlEndTag to match xmlTag (vim/vim#884)
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
11 " 20190924 - Fix xmlAttribute property (amadeus/vim-xml@d8ce1c946)
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
12 " 20191103 - Enable spell checking globally
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " CONFIGURATION:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " syntax folding can be turned on by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " let g:xml_syntax_folding = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " before the syntax file gets loaded (e.g. in ~/.vimrc).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " This might slow down syntax highlighting significantly,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " especially for large files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " CREDITS:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " The original version was derived by Paul Siegmann from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " Claudio Fleiner's html.vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " REFERENCES:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " [1] http://www.w3.org/TR/2000/REC-xml-20001006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " [2] http://www.w3.org/XML/1998/06/xmlspec-report-19980910.htm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " as <hirauchi@kiwi.ne.jp> pointed out according to reference [1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " 2.3 Common Syntactic Constructs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " [5] Name ::= (Letter | '_' | ':') (NameChar)*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " NOTE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " 1) empty tag delimiters "/>" inside attribute values (strings)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " confuse syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " 2) for large files, folding can be pretty slow, especially when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " loading a file the first time and viewoptions contains 'folds'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " so that folds of previous sessions are applied.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " Don't use 'foldmethod=syntax' in this case.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 " Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 if exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 let s:xml_cpo_save = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 set cpo&vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
56 " Allow spell checking in tag values,
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
57 " there is no syntax region for that,
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
58 " so enable spell checking in top-level elements
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
59 " <tag>This text is spell checked</tag>
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
60 syn spell toplevel
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
61
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " mark illegal characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 syn match xmlError "[<&]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 " strings (inside tags) aka VALUES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 " ^^^^^^^
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
71 syn region xmlString contained start=+"+ end=+"+ contains=xmlEntity,@Spell display
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
72 syn region xmlString contained start=+'+ end=+'+ contains=xmlEntity,@Spell display
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " punctuation (within attributes) e.g. <tag xml:foo.attribute ...>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " ^ ^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 " syn match xmlAttribPunct +[-:._]+ contained display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syn match xmlAttribPunct +[:.]+ contained display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " no highlighting for xmlEqual (xmlEqual has no highlighting group)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn match xmlEqual +=+ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 " attribute, everything before the '='
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 " PROVIDES: @xmlAttribHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " ^^^^^^^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn match xmlAttrib
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
94 \ +[-'"<]\@1<!\<[a-zA-Z:_][-.0-9a-zA-Z:_]*\>\%(['"]\@!\|$\)+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 \ contains=xmlAttribPunct,@xmlAttribHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 " namespace spec
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " PROVIDES: @xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 " <xsl:for-each select = "lola">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " ^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 if exists("g:xml_namespace_transparent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 syn match xmlNamespace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
111 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+[:]\@=+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 \ contains=@xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 \ transparent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 syn match xmlNamespace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
118 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+[:]\@=+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 \ contains=@xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 " tag name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 " PROVIDES: @xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 " ^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 syn match xmlTagName
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
135 \ +\%(<\|</\)\@2<=[^ /!?<>"']\++
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 \ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 " start tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 " use matchgroup=xmlTag to skip over the leading '<'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 " PROVIDES: @xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 " <tag id="whoops">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 " s^^^^^^^^^^^^^^^e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 syn region xmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 \ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 \ matchgroup=xmlTag end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 \ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " highlight the end tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 " PROVIDES: @xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 " (should we provide a separate @xmlEndTagHook ?)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 " </tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 " ^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 "
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
170 syn region xmlEndTag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
171 \ matchgroup=xmlTag start=+</[^ /!?<>"']\@=+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
172 \ matchgroup=xmlTag end=+>+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 \ contained
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
174 \ contains=xmlTagName,xmlNamespace,xmlAttribPunct,@xmlTagHook
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 " tag elements with syntax-folding.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 " NOTE: NO HIGHLIGHTING -- highlighting is done by contained elements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 " PROVIDES: @xmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 " <tag id="whoops">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " <!-- comment -->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 " <another.tag></another.tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 " <empty.tag/>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 " some data
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 " </tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 syn region xmlRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 \ start=+<\z([^ /!?<>"']\+\)+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 \ skip=+<!--\_.\{-}-->+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 \ end=+</\z1\_\s\{-}>+
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
194 \ end=+/>+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 \ fold
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
196 \ contains=xmlTag,xmlEndTag,xmlCdata,xmlRegion,xmlComment,xmlEntity,xmlProcessing,@xmlRegionHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 " - contained attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 " - xmlRegion not defined
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 syn region xmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 \ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 \ matchgroup=xmlTag end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 \ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
211 syn region xmlEndTag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
212 \ matchgroup=xmlTag start=+</[^ /!?<>"']\@=+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
213 \ matchgroup=xmlTag end=+>+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
214 \ contains=xmlTagName,xmlNamespace,xmlAttribPunct,@xmlTagHook
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 " &entities; compare with dtd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 syn match xmlEntity "&[^; \t]*;" contains=xmlEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 syn match xmlEntityPunct contained "[&.;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 " The real comments (this implements the comments as defined by xml,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 " but not all xml pages actually conform to it. Errors are flagged.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 syn region xmlComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 \ start=+<!+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 \ end=+>+
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
230 \ contains=xmlCommentStart,xmlCommentError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 \ fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 " - fold attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 syn region xmlComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 \ start=+<!+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 \ end=+>+
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
242 \ contains=xmlCommentStart,xmlCommentError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
247 syn match xmlCommentStart contained "<!" nextgroup=xmlCommentPart
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 7
diff changeset
248 syn keyword xmlTodo contained TODO FIXME XXX
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 syn match xmlCommentError contained "[^><!]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 syn region xmlCommentPart
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 \ start=+--+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 \ end=+--+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 \ contained
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
254 \ contains=xmlTodo,@xmlCommentHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 " CData sections
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 " PROVIDES: @xmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 syn region xmlCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 \ start=+<!\[CDATA\[+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 \ end=+]]>+
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
264 \ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 " using the following line instead leads to corrupt folding at CDATA regions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 " syn match xmlCdata +<!\[CDATA\[\_.\{-}]]>+ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 syn match xmlCdataStart +<!\[CDATA\[+ contained contains=xmlCdataCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 syn keyword xmlCdataCdata CDATA contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 syn match xmlCdataEnd +]]>+ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 " Processing instructions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 " This allows "?>" inside strings -- good idea?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 syn region xmlProcessing matchgroup=xmlProcessingDelim start="<?" end="?>" contains=xmlAttrib,xmlEqual,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 " DTD -- we use dtd.vim here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 syn region xmlDocType matchgroup=xmlDocTypeDecl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 \ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 \ fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 \ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 " - fold attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 syn region xmlDocType matchgroup=xmlDocTypeDecl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 \ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 \ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 syn keyword xmlDocTypeKeyword contained DOCTYPE PUBLIC SYSTEM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 syn region xmlInlineDTD contained matchgroup=xmlDocTypeDecl start="\[" end="]" contains=@xmlDTD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 syn include @xmlDTD <sfile>:p:h/dtd.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 unlet b:current_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 " synchronizing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 " TODO !!! to be improved !!!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 syn sync match xmlSyncDT grouphere xmlDocType +\_.\(<!DOCTYPE\)\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 " syn sync match xmlSyncDT groupthere NONE +]>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 syn sync match xmlSync grouphere xmlRegion +\_.\(<[^ /!?<>"']\+\)\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 " syn sync match xmlSync grouphere xmlRegion "<[^ /!?<>"']*>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 syn sync match xmlSync groupthere xmlRegion +</[^ /!?<>"']\+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 syn sync minlines=100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 " The default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 hi def link xmlTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 hi def link xmlTag Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 hi def link xmlTagName Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 hi def link xmlEndTag Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 if !exists("g:xml_namespace_transparent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 hi def link xmlNamespace Tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 hi def link xmlEntity Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 hi def link xmlEntityPunct Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 hi def link xmlAttribPunct Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 hi def link xmlAttrib Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 hi def link xmlString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 hi def link xmlComment Comment
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
335 hi def link xmlCommentStart xmlComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 hi def link xmlCommentPart Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 hi def link xmlCommentError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 hi def link xmlError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 hi def link xmlProcessingDelim Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 hi def link xmlProcessing Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 hi def link xmlCdata String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 hi def link xmlCdataCdata Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 hi def link xmlCdataStart Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 hi def link xmlCdataEnd Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 hi def link xmlDocTypeDecl Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 hi def link xmlDocTypeKeyword Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 hi def link xmlInlineDTD Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 let b:current_syntax = "xml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 let &cpo = s:xml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 unlet s:xml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 " vim: ts=8