Commit Graph
23 Commits
Author SHA1 Message Date
zeertzjqandJulien Voisin 2fbc82820b vim-patch:964a495: runtime(html): match plain tag and attribute names as keywords (#41522)
Problem:  Several tag and attribute names are highlighted with regular
          expression alternations even though they are plain words.  A
          :syn-match with an alternation is retried at nearly every
          position of every tag.
Solution: Move the plain-word tag names (b, i, u, em, strong, head,
          body, title, h1-h6) and the "label", "href" and "title"
          attribute names into syn-keyword lists, leaving only the
          genuinely hyphenated names "accept-charset" and "http-equiv"
          as matches.

Profiling a 6000-line HTML file with :syntime, the converted rules drop
from a combined 0.044s to 0.004s, lowering total per-rule syntax time
by about 15%.  Highlighting is unchanged except that a bare valueless
"href" attribute is now highlighted as an attribute, consistent with a
bare "title", which already behaved that way.

closes: vim/vim#21155

https://github.com/vim/vim/commit/964a495bef698368f4e200b1d22d63da27f47948

Co-authored-by: Julien Voisin <julien.voisin@dustri.org>
2026-08-28 10:09:15 +08:00
Christian ClasonandAliaksei Budavei a2c3591720 vim-patch:dc7ed8f: runtime(html): Optionally fold tags with the "expr" method
Tag folding poses a few difficulties.  Many elements, e.g.
"blockquote", are always delimited by start and end tags;
end tags for some elements, e.g. "p", can be omitted in
certain contexts; void elements, e.g. "hr", have no end tag.
Although the rules for supporting omissible end tags are
ad-hoc and involved, they apply to elements in scope.
Assuming syntactical wellformedness, an end tag can be
associated with its nearest matching start tag discoverable
in scope and towards the beginning of a file, whereas all
unbalanced tags and inlined tags can be disregarded.

For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <p>Paragraph vim/vim#1.		<!--  = : 2 -->
    <p>				<!-- >3 : 3 -->
      Paragraph vim/vim#2.		<!--  = : 3 -->
    </p>			<!-- <3 : 3 -->
    <p>Paragraph vim/vim#3.</p>	<!--  = : 2 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

(HTML comments here, "<!-- ... -->", record two values for
each folded line that are separated by ":", a value obtained
from "&foldexpr" and a value obtained from "foldlevel()".)

Innermost foldedable tags will be flattened.  For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre><code>		<!-- >4 : 4 -->
[CODE SNIPPET]			<!--  = : 4 -->
      </code></pre>		<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

No folding will be requested for the "<code>"-"</code>" tag
pair and reflected by "&foldexpr" because such a fold would
have claimed the same lines that the immediate fold of the
"<pre>"-"</pre>" tag already claims.

Run-on folded tags may confuse Vim.  When a file such as:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
				<!--  = : 3 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#2]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

is reformatted as follows:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div><div class="block"><pre><code> <!-- <3 : 3 -->
[CODE SNIPPET vim/vim#2]		<!--  = : 2 ? -->
	</code>			<!-- <5 : 2 ? -->
      </pre>			<!-- <4 : 2 ? -->
    </div>			<!-- <3 : 2 ? -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

"&foldexpr" values will not be used as is for the lines
between (and including) "[CODE SNIPPET vim/vim#2]" and "</div>".
(Cf. v9.1.0002.)

Having syntax highlighting in effect, tag folding using the
"fold-expr" method can be enabled with:
------------------------------------------------------------
	let g:html_expr_folding = 1
------------------------------------------------------------

By default, tag folding will be redone from scratch after
each occurrence of a TextChanged or an InsertLeave event.
Such frequency may not be desired, especially for large
files, and this recomputation can be disabled with:
------------------------------------------------------------
	let g:html_expr_folding_without_recomputation = 1
        doautocmd FileType
------------------------------------------------------------

To force another recomputation, do:
------------------------------------------------------------
	unlet! b:foldsmap
	normal zx
------------------------------------------------------------

References:
https://web.archive.org/web/20250328105626/https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
https://en.wikipedia.org/wiki/Dangling_else

closes: vim/vim#17141

https://github.com/vim/vim/commit/dc7ed8f946a3109460435221ad45f92486c4ebca

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-05-11 10:47:39 +02:00
Christian ClasonandChristian Brabandt 1dd2bf926d vim-patch:df9f67e: runtime(html): update syntax script to sync by 250 minlines by default
closes: vim/vim#14071

https://github.com/vim/vim/commit/df9f67e10d214e0124f2141f59593529801307a4

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-07-31 00:18:32 +02:00
Christian ClasonandMohamed Akram 72ddf213a1 vim-patch:917ff8a: runtime(html): bump length of character references in syntax script (vim/vim#15022)
This allows handling longer references such as
`&CounterClockwiseContourIntegral;`.

https://github.com/vim/vim/commit/917ff8a19d2746dd922b7292dc61fb92e18b7ce2

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2024-06-16 23:24:55 +02:00
Christian Clasonanddkearns 8594b0858f vim-patch:a9058440b7b9
runtime(html): Update syntax file (vim/vim#13591)

Add missing search element and update ARIA attribute list.

Add a very basic test file to check all elements are matched.

https://github.com/vim/vim/commit/a9058440b7b9d7f5d0027c8cd44366e9200ca241

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-11-29 21:00:07 +01:00
zeertzjqandBram Moolenaar ee26b227e1 vim-patch:partial:938ae280c79b (#22356)
Update runtime files.

https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a

Partially skip autocmd.txt: needs patch 8.2.5011.
Partially skip builtin.txt: needs patch 9.0.0411.
Partially skip eval.txt: needs patch 8.2.3783.
Cherry-pick :map-meta-keys from patch 9.0.1276.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-21 23:50:29 +08:00
Sean DewarandBram Moolenaar 7c57f06b63 vim-patch:partial:d13166e788fc (#21109)
Update runtime files

https://github.com/vim/vim/commit/d13166e788fcaef59ec65c20b46ca4be16625669

- Skip E1309-1311 (not ported).
- Skip `:echowindow` changes (not ported).
- Skip termdebug winbar doc changes (not fully ported).
- Port missing `g:termdebug_config.{wide,use_prompt}` changes from v8.2.5010.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-19 10:31:51 +00:00
Christian Clason 4cbeedf57b vim-patch:b529cfbd04c0 (#19501)
Update runtime files
https://github.com/vim/vim/commit/b529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d
2022-07-26 11:26:23 +02:00
Jan Edmund Lazo eea3a692c6 vim-patch:c8cdf0f80b3c
Update runtime files.
https://github.com/vim/vim/commit/c8cdf0f80b3cfd88a4490d80572062c1fd1a96ca
2021-05-02 10:33:32 -04:00
Jan Edmund Lazo 6a8436065c vim-patch:9faec4e3d439
Update runtime files.
https://github.com/vim/vim/commit/9faec4e3d439968e21ad74e917aebb289df8f849

Omit vim9.
2021-05-02 10:23:35 -04:00
Jan Edmund Lazo c287e734f1 vim-patch:ff78155aa175
Update runtime files
https://github.com/vim/vim/commit/ff78155aa1755aced96a3b343e81939c94aac721

Omit menu_info().
2021-04-27 21:31:28 -04:00
Jan Edmund Lazo ae362c2120 vim-patch:5666fcd0bd79
Update runtime files.
https://github.com/vim/vim/commit/5666fcd0bd794dd46813824cce63a38bcae63794

Do not manually port E290 error message.
Neovim has E5030,E5031 error messages to replace E290.
2021-04-27 09:21:33 -04:00
Justin M. Keyes 4d830ca31b vim-patch:62e1bb4a111e
Update runtime files.
https://github.com/vim/vim/commit/62e1bb4a111e7ce570c30965f40a68a07a9da5b0

NA: vim-patch:496555fd1821
2019-08-01 22:58:20 +02:00
Justin M. Keyes 93a85bdd8a vim-patch:d2f3a8b87873
Update runtime files.
https://github.com/vim/vim/commit/d2f3a8b8787333abf2300d38836b196955f10c00
2018-10-29 09:32:29 +01:00
Justin M. Keyes dae1213e57 vim-patch:f0b03c4e98f8
Update runtime files
https://github.com/vim/vim/commit/f0b03c4e98f8a7184d8b4a5d702cbcd602426923

Note: haskell changes were included in 942f3587c3
2018-10-28 13:57:08 +01:00
Justin M. Keyes 4175dfac9a vim-patch:01164a6546b4
Long overdue runtime update.

https://github.com/vim/vim/commit/01164a6546b4c635daf96a1f17d1cb2d07f32a66
2017-11-07 23:07:03 +01:00
Justin M. Keyes ac107f7fdd vim-patch:690afe1fef87
Update runtime files.

https://github.com/vim/vim/commit/690afe1fef87e7eef6fb7343a926617d5f7315fa
2017-05-01 13:23:12 +02:00
Justin M. Keyes 44ea50cee4 vim-patch:68563937f58e
Updated runtime files.

https://github.com/vim/vim/commit/68563937f58ea2dc31b58739336c383d2fd7e6cf
2017-05-01 13:13:51 +02:00
Justin M. Keyes 4fbcfab127 vim-patch:bc2eada5424b
Updated runtime files.

https://github.com/vim/vim/commit/bc2eada5424bff06f7eb77c032ecc067da52b846

NA patches:
vim-patch:294740d2ac42
vim-patch:a4ce25bd987a
vim-patch:7034a8374345
vim-patch:14a612fa2e57
vim-patch:aaeabfbca571
2017-05-01 12:30:54 +02:00
Justin M. Keyes 86b596dc7a vim-patch:f37506f60f87
Updated runtime files.  Remove HiLink commands.

https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
2017-04-28 21:25:15 +02:00
Justin M. Keyes a53409b564 vim-patch:89bcfda6834a
Updated runtime files.  Remove version checks for Vim older than 6.0.

https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
2017-04-28 21:13:55 +02:00
rosston d69f3bbb0d vim-patch:8feef4f #3444
Update runtime files.

https://github.com/vim/vim/commit/8feef4ff6253afb9dcc61c40082ed4fbb96b685c
2015-10-11 18:07:58 -04:00
Justin M. Keyes a98a6996c2 re-integrate runtime/ vim-patch:0 #938
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7

Excluding:
  Amiga icons (*.info, icons/)
  doc/hangulin.txt
  tutor/
  spell/
  lang/ (only used for menu translations)
  macros/maze/, macros/hanoi/, macros/life/, macros/urm/
      These were used to test vi compatibility.
  termcap
      "Demonstration of a termcap file (for the Amiga and Archimedes)"

Helped-by: Rich Wareham <rjw57@cam.ac.uk>
Helped-by: John <john.schmidt.h@gmail.com>
Helped-by: Yann <yann@yann-salaun.com>
Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com>
Helped-by: drasill <github@tof2k.com>
Helped-by: Tae Sandoval Murgan <taecilla@gmail.com>
Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
2014-07-29 02:12:31 +00:00