100 Commits
Author SHA1 Message Date
leafOfTree 18c1d17f59 Update README
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
test / shared cases with vim-svelte-plugin (push) Canceled after 0s
- Add tested Vim and Neovim versions and the lnum argument of GetVueTag()
- Remove the tip to edit $VIMRUNTIME/syntax/vue.vim, which isn't loaded
  as this plugin is added to the start of runtimepath
- Add ./test/shared.sh to test commands
2026-10-21 14:12:47 +00:00
leaf b8bcfbdd69 Merge pull request #50 from leafOfTree/shared-tests
Add shared test cases with vim-svelte-plugin, fix indent after empty tag
2026-10-21 22:10:43 +08:00
leafOfTree faf8f75a4f Add shared test cases with vim-svelte-plugin
Name cases for scenarios also in vim-svelte-plugin as shared-*, adding
one for multiline tags. test/shared.sh lists shared cases in only one
of the plugins, as a warning in a separate job on GitHub Actions.
2026-10-21 14:03:35 +00:00
leafOfTree ed9e40037f Fix indent after an empty tag with '>' in attributes
A line like <input @input="(e) => update(e)" /> was taken as an empty
tag without '/>', as '>' in '=>' matched its end, so the next line was
indented one level less. Skip '>' in quotes, and don't take '/>' as the
end of an empty tag.
2026-10-21 14:03:35 +00:00
leaf ef886ddbd1 Merge pull request #49 from leafOfTree/help-doc
Add help doc
2026-10-21 21:58:58 +08:00
leaf f812facf6d Merge pull request #48 from leafOfTree/missing-syntax-indent
Handle syntax without syntax or indent files
2026-10-21 21:58:46 +08:00
leafOfTree 7a2f8ac5cd Add help doc
Add doc/vim-vue-plugin.txt for :help with the configuration and
functions in README.
2026-10-21 13:52:54 +00:00
leafOfTree 84fe692afe 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 [].
2026-10-21 13:52:18 +00:00
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
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 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 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
leafOfTree 3d2680a859 Support view block 2021-07-30 14:41:13 +08:00
leafOfTree cda82484d2 Update doc 2021-06-15 12:30:38 +08:00
leafOfTree 0e341ab4f8 Simplify example config 2021-06-15 12:29:47 +08:00
leafOfTree a5882eb712 Update doc 2021-06-05 16:02:34 +08:00
leafOfTree 568b571849 Update doc 2021-06-05 16:00:32 +08:00
leafOfTree b2b08cda9d Improve oneline block syntax 2021-06-02 13:51:42 +08:00
leafOfTree c43bd87267 Support oneline block 2021-06-02 13:20:40 +08:00
leafOfTree 98e22f2af4 Rename function name for clearer meaning 2021-05-20 11:47:17 +08:00
leafOfTree 43490363a5 Update doc 2021-05-19 11:20:04 +08:00
leafOfTree 50ea0b7bce Update CI config 2021-05-18 16:07:16 +08:00
leafOfTree 696533d262 Update doc 2021-05-12 19:09:04 +08:00
leafOfTree 9ae107ea6f Fix script fold issue 2021-05-10 14:02:08 +08:00
leafOfTree b8cbd66359 Use user's option when setting 2021-05-10 13:25:38 +08:00
leafOfTree 0f4b6b7b7e Update doc 2021-05-05 21:03:48 +08:00
leafOfTree 12e5eadbad Update doc 2021-05-05 20:59:04 +08:00
leafOfTree 617639320d Update doc 2021-05-05 20:57:51 +08:00
leafOfTree 511fb2fb82 Update doc 2021-05-05 20:56:59 +08:00
leafOfTree b8f8a45e44 Update doc 2021-05-05 20:54:48 +08:00
leafOfTree 32b89ad2bf Update doc 2021-04-26 16:03:04 +08:00
leafOfTree 9e642cc983 Update doc 2021-04-23 13:21:43 +08:00
leafOfTree 8a913af7a6 setlocal foldenable to default value (on) 2021-04-23 13:06:51 +08:00
leafOfTree 9e55939c89 Rename subtype to syntax 2021-04-23 12:49:55 +08:00
leafOfTree 5067a5cc25 Update doc 2021-04-19 18:59:32 +08:00
leafOfTree c4847c18e9 Update doc 2021-04-19 14:20:56 +08:00
leafOfTree d080255fce Fix foldexpr 2021-04-19 14:20:37 +08:00
leafOfTree 8f23970cf9 Update doc 2021-04-19 09:50:11 +08:00
leafOfTree d8a5c1486b Update doc 2021-04-19 09:39:44 +08:00
leafOfTree 8f0d26991a Update doc 2021-04-19 09:36:57 +08:00
leafOfTree 2a682014a3 Update doc 2021-04-16 16:22:57 +08:00
leafOfTree 483e45e198 Change options order 2021-04-16 16:22:51 +08:00
leafOfTree f1b7ea05b8 Backwards compatibility with init_indent 2021-04-16 14:46:11 +08:00
leafOfTree 6a94c30ec7 Add new 'initial indent' option 2021-04-16 13:33:56 +08:00
leafOfTree 87922641ad Fix various indent issues 2021-04-15 18:49:29 +08:00
leafOfTree 3ed1e89f55 Defer indent load time 2021-04-15 13:10:22 +08:00
leafOfTree ed7e1a9898 Use runtime typescript indent for javascript 2021-04-14 22:50:37 +08:00