Commit Graph
14 Commits
Author SHA1 Message Date
leafOfTree de9fbec1ad Handle syntax without syntax or indent files
A syntax in the config without a syntax file, like postcss, showed
E484 on opening a file. Skip loading it, with a warning in debug.

A syntax without an indent file used cindent, which broke indent of
languages like pug, stylus without their plugins, or toml. Keep the
indent instead. Lines outside blocks still use cindent.
2026-10-21 13:51:38 +00:00
leaf 824aff651d Merge pull request #47 from leafOfTree/lang-attr
test / vim stable (push) Canceled after 0s
test / vim v8.2.0000 (push) Canceled after 0s
test / nvim stable (push) Canceled after 0s
test / nvim v0.9.5 (push) Canceled after 0s
Allow lang without quotes and lang="typescript"
2026-10-21 21:15:00 +08:00
leaf 983942b6d8 Merge pull request #46 from leafOfTree/ci-matrix
Test with several Vim and Neovim versions and fixed deps
2026-10-21 20:22:51 +08:00
leaf 25e386280c Merge pull request #45 from leafOfTree/undo-ftplugin
Undo ftplugin and indent settings when filetype changes
2026-10-21 20:22:29 +08:00
leaf cfe4bd4711 Merge pull request #44 from leafOfTree/css-group-error
Fix E409 when css syntax isn't loaded
2026-10-21 20:21:54 +08:00
leaf 047a73947b Merge pull request #43 from leafOfTree/shiftwidth-zero
Support shiftwidth=0 in indent and fold
2026-10-21 20:21:36 +08:00
leafOfTree 36bc3f9a87 Test with several Vim and Neovim versions and fixed deps
Run tests on GitHub Actions with Vim 8.2.0000, the latest Vim, Neovim
0.9.5 and the latest Neovim by rhysd/action-setup-vim. test/run.sh only
uses the editors in $VUE_TEST_EDITORS if set, and fails if none runs.

Clone the syntax plugins for tests at fixed commits, so changes there
don't break tests unexpectedly.
2026-10-21 12:14:02 +00:00
leafOfTree 063231ca9e Allow lang without quotes and lang="typescript"
<script lang=ts> and <style lang=sass> without quotes weren't
recognized, so they used the first syntax in the config. For sass, it
also flattened the nesting when indenting. lang="typescript" wasn't
recognized either.

Languages not in the config still use the first syntax as before.
2026-10-21 12:13:24 +00:00
leafOfTree 07df7903af Undo ftplugin and indent settings when filetype changes
Set b:undo_ftplugin for matchpairs, matchit variables, b:syng_str and
the foldexpr settings, and b:undo_indent for indent settings, instead of
relying on whichever indent file was loaded last.
2026-10-21 12:12:56 +00:00
leafOfTree bbe547e7dd Fix E409 when css syntax isn't loaded
The v-bind() region in style contains cssValue.* groups, which don't
exist without css syntax, like when syntax in the config has only
script. Opening a file then showed E409 and E475. Add the style
highlights only if css syntax is loaded.
2026-10-21 12:12:18 +00:00
leafOfTree abb7144824 Support shiftwidth=0 in indent and fold
With shiftwidth=0, Vim uses the value of tabstop, but &sw is 0. So
multiline tags and brackets got wrong indent, and fold levels were wrong
as indent was divided by 0. Use shiftwidth() instead, which is the same
as &sw when it isn't 0.
2026-10-21 12:11:58 +00:00
leafOfTree acdcadc39b Fix undefined a:block in indent
s:AdjustBlockIndent() had `let block = a:block` without such an argument,
so GetVueIndent() hit E121 for every line in template, script and style.
It was hidden as errors in 'indentexpr' are silent and the function goes
on, but showed up when calling GetVueIndent() directly.

Also return [0, 0] in s:PrevMultilineEmptyTag() when no tag start is
found, instead of no value.

Add ExpectIndentEachLine() for tests to call GetVueIndent() for each
line and check the result.
2026-10-21 12:11:30 +00:00
leafOfTree 68b866210b Test all features
test / test (push) Canceled after 0s
Add cases for attribute highlight on and off, block syntax by lang
and emmet-vim group names, OnChangeVueSyntax(), matchit, .wpy,
initial_indent as syntax and tag.syntax, and syntax after reloading.

Also check indenting a file after removing all indent with
g:test_flatten, which fails before the end tag fix as closing tags at
column 0 were taken as block end tags.
2026-10-20 01:21:17 +00:00
leafOfTree de812d609b Add tests and GitHub Actions
Replace the Travis tests, which used a separate repo and no longer
ran, with tests in this repo. Each case in test/cases is indented as
a whole and should be unchanged, with optional syntax, fold and tag
checks. The cases are from the previous tests, plus script-setup.vue
for <script setup> keywords and a sync check in oneline.vim.

test/run.sh runs the cases with Vim in a pseudo terminal, as syntax in
Ex mode isn't the same, and Neovim headless.
2026-10-19 14:20:24 +00:00