leafOfTree / vim-vue-plugin

Vim syntax and indent plugin for .vue files
The Unlicense
177 stars 9 forks source link

Neovim setup? #38

Closed im-n1 closed 11 months ago

im-n1 commented 1 year ago

Hi I'm trying to set this plugin up on Neovim and it doesn't highlight work at all. When I turn on debug ths is what I get

"~/workspace/richy/app/app/richy/core/static/js/components/item_chart.vue" 478L, 13488B
[vim-vue-plugin] pug: syntax not found in ['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']
[vim-vue-plugin] pug: load full instead
[vim-vue-plugin] pug: load full
"~/workspace/richy/app/app/richy/core/static/js/components/the_eye.vue" 100L, 2056B
[vim-vue-plugin] pug: syntax not found in ['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']
[vim-vue-plugin] pug: load full instead
[vim-vue-plugin] pug: load full
"~/workspace/richy/app/app/richy/core/static/js/components/chart.vue" 122L, 2681B
[vim-vue-plugin] pug: syntax not found in ['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']
[vim-vue-plugin] pug: load full instead
[vim-vue-plugin] pug: load full
[vim-vue-plugin] html: load default

What exacty I'm missing?

Thanks in advance.

leafOfTree commented 1 year ago

Hi, there. Sorry for the late response.

Could you confirm if it works with the default config and a simple .vue file? Is there no highlight at all, or is it broken?

Neovim seems to work for me with the default config

  let g:vim_vue_plugin_config = { 
      \'syntax': {
      \   'template': ['html'],
      \   'script': ['javascript'],
      \   'style': ['css'],
      \},
      \'full_syntax': [],
      \'initial_indent': [],
      \'attribute': 0,
      \'keyword': 0,
      \'foldexpr': 0,
      \'debug': 0,
      \}

Screenshot 2023-01-31 at 13 23 37

im-n1 commented 1 year ago

Sorry for the late response :) Tried but sadly <script> is not highlighted at all.

leafOfTree commented 11 months ago

Hi, I tried again with nvim v0.9.2 by simply adding this plugin to runtimepath. It looks good to me. My guess is that there may be another plugin interfering with the syntax. Could you try excluding others and then see how it works?

init.vim

set runtimepath+=~/.vim/plugged/vim-vue-plugin
Screen Shot 2023-09-22 at 17 09 59
im-n1 commented 11 months ago

After a long battle with node/npm/ts and slightly lsp I might have a clue - Looks like tree sitter is the problem. Once I disable it a vue file looks like this:

image

The script part is highlighted very poorly but it's still something.

leafOfTree commented 11 months ago

I see.

The script part uses the same basic syntax as a normal javascript file. You can try the full_syntax to include highlights from plugins.

  let g:vim_vue_plugin_config = { 
      \'syntax': {
      \   'template': ['html'],
      \   'script': ['javascript', 'typescript'],
      \   'style': ['css'],
      \},
      \'full_syntax': ['javascript', 'typescript'],
      \}

You can also try nvim-treesitter with :TSInstall vue, but not enable both plugins at the same time.

im-n1 commented 11 months ago

Just tried treesitter's vue and it's amazing. We are done here, thanks.