From 2ed782e4224ff12619f4c5d85a20700f067ce8cb Mon Sep 17 00:00:00 2001 From: leafOfTree Date: Tue, 20 Oct 2026 01:18:18 +0000 Subject: [PATCH] Sync syntax from start Syncing by block start patterns didn't restore states inside the block, so syntax computed before a line was displayed, e.g. by GetVueTag() or indent after jumping in a file, missed regions like a multi-line css rule. This replaces the one-line block fix in the previous commit. Parsing from start takes ~190ms once for jumping to the end of a 6500-line file, and states are cached after that. --- syntax/vue.vim | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/syntax/vue.vim b/syntax/vue.vim index edfafa6..4aeddd5 100644 --- a/syntax/vue.vim +++ b/syntax/vue.vim @@ -124,12 +124,6 @@ function! s:SetSyntax(block, syntax, has_lang) \.' end=+'.end.'+' \.' keepend contains='.syntax_group.', vueTag' - " Don't sync to a block ending on the same line, like - " - let sync_start = start.'\(.*'.end_tag.'\)\@!' - execute 'syntax sync match vueSync groupthere '.name.' +'.sync_start.'+' - execute 'syntax sync match vueSync groupthere NONE +'.end.'+' - " Block like let oneline = start.'.*'.end_tag execute 'syntax match '.name.' fold ' @@ -138,7 +132,10 @@ function! s:SetSyntax(block, syntax, has_lang) endfunction function! s:SetBlockSyntax(config_syntax) + " Parse from start, as syncing by block start doesn't restore states inside + " the block like a multi-line css rule syntax sync clear + syntax sync fromstart for [block, syntax] in items(a:config_syntax) let type = type(syntax)