aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/html.vim
Commit message (Collapse)AuthorAge
* vim-patch:cb5ebfb: runtime(html): Update syntax, improve syncing (#41890)zeertzjq2026-09-13
| | | | | | | | fixes: vim/vim#10452 closes: vim/vim#21287 https://github.com/vim/vim/commit/cb5ebfb39ae25805a1e5a8b81bec62da7239ca2c Co-authored-by: Doug Kearns <dougkearns@gmail.com>
* vim-patch:964a495: runtime(html): match plain tag and attribute names as ↵zeertzjq2026-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* vim-patch:dc7ed8f: runtime(html): Optionally fold tags with the "expr" methodChristian Clason2025-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* vim-patch:df9f67e: runtime(html): update syntax script to sync by 250 ↵Christian Clason2024-07-31
| | | | | | | | | | minlines by default closes: vim/vim#14071 https://github.com/vim/vim/commit/df9f67e10d214e0124f2141f59593529801307a4 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:917ff8a: runtime(html): bump length of character references in ↵Christian Clason2024-06-16
| | | | | | | | | | | 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>
* vim-patch:a9058440b7b9Christian Clason2023-11-29
| | | | | | | | | | | | 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>
* vim-patch:partial:938ae280c79b (#22356)zeertzjq2023-02-21
| | | | | | | | | | | | 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>
* vim-patch:partial:d13166e788fc (#21109)Sean Dewar2022-11-19
| | | | | | | | | | | | 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>
* vim-patch:b529cfbd04c0 (#19501)Christian Clason2022-07-26
| | | | Update runtime files https://github.com/vim/vim/commit/b529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d
* vim-patch:c8cdf0f80b3cJan Edmund Lazo2021-05-02
| | | | | Update runtime files. https://github.com/vim/vim/commit/c8cdf0f80b3cfd88a4490d80572062c1fd1a96ca
* vim-patch:9faec4e3d439Jan Edmund Lazo2021-05-02
| | | | | | | Update runtime files. https://github.com/vim/vim/commit/9faec4e3d439968e21ad74e917aebb289df8f849 Omit vim9.
* vim-patch:ff78155aa175Jan Edmund Lazo2021-04-27
| | | | | | | Update runtime files https://github.com/vim/vim/commit/ff78155aa1755aced96a3b343e81939c94aac721 Omit menu_info().
* vim-patch:5666fcd0bd79Jan Edmund Lazo2021-04-27
| | | | | | | | 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.
* vim-patch:62e1bb4a111eJustin M. Keyes2019-08-01
| | | | | | | Update runtime files. https://github.com/vim/vim/commit/62e1bb4a111e7ce570c30965f40a68a07a9da5b0 NA: vim-patch:496555fd1821
* vim-patch:d2f3a8b87873Justin M. Keyes2018-10-29
| | | | | Update runtime files. https://github.com/vim/vim/commit/d2f3a8b8787333abf2300d38836b196955f10c00
* vim-patch:f0b03c4e98f8Justin M. Keyes2018-10-28
| | | | | | | Update runtime files https://github.com/vim/vim/commit/f0b03c4e98f8a7184d8b4a5d702cbcd602426923 Note: haskell changes were included in 942f3587c38a83cf6486a0b779765b54a1648493
* vim-patch:01164a6546b4Justin M. Keyes2017-11-07
| | | | | | Long overdue runtime update. https://github.com/vim/vim/commit/01164a6546b4c635daf96a1f17d1cb2d07f32a66
* vim-patch:690afe1fef87Justin M. Keyes2017-05-01
| | | | | | Update runtime files. https://github.com/vim/vim/commit/690afe1fef87e7eef6fb7343a926617d5f7315fa
* vim-patch:68563937f58eJustin M. Keyes2017-05-01
| | | | | | Updated runtime files. https://github.com/vim/vim/commit/68563937f58ea2dc31b58739336c383d2fd7e6cf
* vim-patch:bc2eada5424bJustin M. Keyes2017-05-01
| | | | | | | | | | | | | 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
* vim-patch:f37506f60f87Justin M. Keyes2017-04-28
| | | | | | Updated runtime files. Remove HiLink commands. https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
* vim-patch:89bcfda6834aJustin M. Keyes2017-04-28
| | | | | | Updated runtime files. Remove version checks for Vim older than 6.0. https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
* vim-patch:8feef4f #3444rosston2015-10-11
| | | | | | Update runtime files. https://github.com/vim/vim/commit/8feef4ff6253afb9dcc61c40082ed4fbb96b685c
* re-integrate runtime/ vim-patch:0 #938Justin M. Keyes2014-07-29
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>