Merge syntax config per block

syntax in g:vim_vue_plugin_config replaced the whole default, so
{'syntax': {'script': ['javascript', 'typescript']}} removed template
and style, which then had no highlight or indent. Replace the default
of each key separately, like vim-svelte-plugin. A block can be removed
by setting it to [].
This commit is contained in:
leafOfTree committed 2026-10-21 13:52:18 +00:00
1 parent 824aff651d
commit 84fe692afe
5 files changed
+36 -3

No files matched your search

+7 -1
View File
@@ -28,10 +28,16 @@ function! s:MergeUserConfigIntoDefault(user)
\'debug': 0,
\}
" Each key of syntax replaces the default of the same key, so blocks not in
" user config keep their default syntax
let user = a:user
for key in keys(default)
if has_key(user, key)
let default[key] = user[key]
if key ==# 'syntax' && type(user[key]) == v:t_dict
call extend(default[key], user[key])
else
let default[key] = user[key]
endif
endif
endfor