Skip to content

Add g:vim_svelte_plugin_config for syntax of blocks - #32

Merged
leafOfTree merged 1 commit into
masterfrom
generic-config
Oct 21, 2026
Merged

leafOfTree merged 1 commit into
masterfrom
generic-config

Conversation

@leafOfTree

Copy link
Copy Markdown
Owner

Based on svelte-fixes, please merge that first.

Like vim-vue-plugin, set syntax of <script>, <style> and <template lang="..."> blocks by g:vim_svelte_plugin_config, the recommended configuration, with full_syntax, initial_indent, attribute, foldexpr, open_devdocs and debug. Any syntax like postcss can be used by lang="...".

let g:vim_svelte_plugin_config = {
      \ 'syntax': {
      \   'script': ['javascript', 'typescript'],
      \   'style': ['css', 'scss', 'sass'],
      \ },
      \ }

Compatibility:

  • Previous g:vim_svelte_plugin_* variables still work as the default of the config, whose options take precedence.
  • For all existing test cases, the syntax stack at the start and end of each line and the indent from no indent are the same as before.
  • Blocks of pug, coffee, sass and stylus not enabled now keep indent, instead of errors from indent functions not loaded, which removed all indent.
  • A syntax not found in Vim, like stylus by use_stylus, is loaded from plugins, as only load_full_syntax did before.

Tests: config, config-override, custom-lang, lang-not-enabled.

Like vim-vue-plugin, set syntax of <script>, <style> and
<template lang="..."> blocks by g:vim_svelte_plugin_config, with
full_syntax, initial_indent, attribute, foldexpr, open_devdocs and debug.
Blocks, syntax loading and indent are by the config instead of code for
each language, so any syntax like postcss can be used by lang="...".

Previous g:vim_svelte_plugin_* variables still work as the default of
the config, whose options take precedence. The syntax at each line and
indent of existing test cases are unchanged.

Blocks of pug, coffee, sass and stylus not enabled now keep indent,
instead of errors from their indent functions not loaded, which removed
all indent. A syntax not found in Vim like stylus is loaded from plugins.
@leafOfTree
leafOfTree merged commit a76ac3e into master Oct 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant