Commit Graph
448 Commits
Author SHA1 Message Date
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
leaf fc45b47958 Merge pull request #42 from leafOfTree/fix-indent-error
Fix undefined a:block in indent
2026-10-21 20:21:14 +08:00
leafOfTree d1b9d6a734 Update README
- Add test badge
- Link to the current Single File Components guide
- Remove unused Travis badge link
2026-10-21 12:14:10 +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 ee1a608c40 Remove logo height in README
test / test (push) Canceled after 0s
GitHub shows a background with rounded corners for images with both
width and height, so the transparent logo had a box behind it.
2026-10-20 01:31:33 +00:00
leaf ddf4a96bdb Merge pull request #41 from leafOfTree/fix-sync-and-tests
Fix syntax sync and end tag, highlight <script setup> macros, add tests
2026-10-20 09:22:22 +08: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 2ed782e422 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.
2026-10-20 01:18:18 +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
leafOfTree d87fbbdde4 Use rtp^= for manual installation in README
Vim 9 and Neovim have placeholder vue syntax and indent files, which
load html ones and take precedence over this plugin added by rtp+=.
2026-10-19 13:43:15 +00:00
leafOfTree b899ab9d54 Highlight Vue 3.3+ APIs and <script setup> macros (#24)
Add the APIs from https://vuejs.org/api/ that were missing, like
defineProps, defineEmits, defineModel, withDefaults, useTemplateRef
and toValue, and the options emits, expose, slots and serverPrefetch.

Also highlight them before type arguments, e.g.
defineProps<{ foo: string }>() or ref<number>(1).
2026-10-19 13:43:00 +00:00
leafOfTree e0de1005bf Get block tag of the end tag line
GetVueTag() returned '' on the end tag line like </template>, as the
check for blank lines after a block also applied to the end tag line
itself.
2026-10-19 13:42:16 +00:00
leafOfTree 1e6923dcd2 Don't sync syntax to a block ending on the same line
A one-line block like <style>p { color: red; }</style> matched the
sync pattern of the block start, so when Vim synced syntax at or after
it, e.g. after jumping to a later line, the following blocks were
taken as inside the style block.
2026-10-19 13:42:16 +00:00
leafOfTree 04c3fb20ed Load all tags after syntax instead of only style 2023-10-05 11:51:45 +08:00
leafOfTree 58ac69b2c8 Update doc 2023-02-02 12:33:31 +08:00
leafOfTree 4d31393b03 Remove timer usage 2023-01-31 17:29:23 +08:00
leafOfTree 8d75429260 Fix syntax lost issue when using netrw :Vexplore 2023-01-31 15:31:52 +08:00
leafOfTree ed318345cf Simplify html syntax commands 2023-01-31 15:17:32 +08:00
leafOfTree 84ac1d2359 Highlight <script...> as htmlTagName instead of htmlSpecialTagName from built-in syntax 2022-10-11 14:16:21 +08:00
leafOfTree 4da7d448ae Fix GetVueTag for blank lines between blocks 2022-06-15 14:22:54 +08:00
leafOfTree ac76f21419 Update doc 2022-06-15 11:59:05 +08:00
leafOfTree be0f84ebb5 Update doc 2022-06-15 11:41:42 +08:00
leafOfTree 3b90ccad2d Update 2022-06-15 11:32:33 +08:00
leafOfTree b2bb4dd8f6 Fix miniprogram syntax containing blank 2022-03-03 15:27:17 +08:00
leafOfTree b4c9fdc87a Update doc 2022-02-21 16:25:10 +08:00
leafOfTree 6569315461 Update doc 2022-02-21 16:24:09 +08:00
leafOfTree 5977fc07fe Update doc 2022-02-21 16:23:04 +08:00
leafOfTree a8decb75b1 Remove fold timer to support makeview/loadview 2021-11-05 17:50:11 +08:00
leafOfTree 469c43292d Fix syntax error for directives without value 2021-11-05 17:50:11 +08:00
leafOfTree dd0e3145af Update doc 2021-09-12 10:47:58 +08:00
leafOfTree a5be3e6c3a Update doc 2021-09-12 10:46:44 +08:00
leafOfTree 7f4c259d27 Fix fold level of blank lines in <script> 2021-09-10 13:20:12 +08:00
leafOfTree 8e121ce67d Update doc 2021-09-10 12:03:57 +08:00
leafOfTree 6678475a50 Update doc 2021-09-06 16:08:55 +08:00
leafOfTree 0432e150dc Update doc 2021-09-06 16:07:32 +08:00
leafOfTree 15143762b8 Update doc 2021-09-06 15:58:31 +08:00
leafOfTree 3fa4bea6df Fix keyword error from containedin pattern 2021-08-13 19:05:46 +08:00
leafOfTree c248bd1488 Load syntax and then set syntax to fix syntax sync 2021-08-13 16:56:22 +08:00
leafOfTree 6e25aaf388 Fix syntax sync being cleared issue 2021-08-13 16:47:13 +08:00
leafOfTree 8d464e9506 Support vue3 API keywords 2021-08-13 16:29:57 +08:00
leafOfTree ab96ba2585 Support global api syntax 2021-08-13 13:08:06 +08:00
leafOfTree 4dd559c860 Support vue3 composition api 2021-08-13 12:50:34 +08:00
leafOfTree d15590dae2 Format code 2021-08-11 18:35:52 +08:00
leafOfTree eb3bba0ccb Support style v-bind syntax 2021-08-11 18:32:10 +08:00
leafOfTree e4ddccee90 Update doc 2021-08-05 16:37:20 +08:00
leafOfTree 0e68102487 Improve multiple line tag syntax and custom tag indent 2021-08-04 11:14:15 +08:00
leafOfTree 44b0071e2d Add custom tags 2021-08-02 15:02:30 +08:00