leafOfTree/vim-vue-plugin

Vue SFC custom block support ?

IndexXuan opened this issue · 6 comments

Thanks for this awesome plugin.
can we support Vue SFC custom block like , or something.

e.g. https://github.com/intlify/vite-plugin-vue-i18n
e.g. https://github.com/ktsn/vue-route-generator#route-custom-block

thanks a lot.

That's a good idea. Definitely, we should. I'll check it soon.

I've added the feature. Please try and let me know if it works.

Here's the doc: https://github.com/leafOfTree/vim-vue-plugin#custom-blocks

Example

let g:vim_vue_plugin_custom_blocks = { 
      \'docs': 'markdown',
      \'i18n': ['json', 'yaml', 'json5'],
      \}

Should highlight custom blocks in .vue file such as

<docs>
# This is the documentation for component.
</docs>

<i18n lang="yaml">
en:
  hello: "Hello World!"
ja:
  hello: "こんにちは、世界!"
</i18n>

image
sorry, there are some errors .

Hi, IndexXuan, which vim version do you use? It seems that your vim doesn't support the optional function argument. I've replaced it with a normal argument. Hope it'll solve the errors. b24ce56

Also, you probably need to install a vim json5 plugin since vim doesn't support it by default yet.

@leafOfTree It works, thanks for this awesome plugin. switch from vim-vue to it now.
also I am use nvim 0.5.0.

yes, after install json5 plugin, it even work for json-like syntax.