leafOfTree / vim-vue-plugin

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

What is this feature? #33

Closed felipe-heredia closed 3 years ago

felipe-heredia commented 3 years ago

I put this config in my init.vim:

let g:vim_vue_plugin_config = { 
      \'syntax': {
      \   'template': ['html', 'pug'],
      \   'script': ['javascript', 'typescript', 'coffee'],
      \   'style': ['scss', 'sass', 'less', 'stylus'],
      \   'i18n': ['json', 'yaml'],
      \   'route': 'json',
      \   'docs': 'markdown',
      \   'page-query': 'graphql',
      \},
      \'full_syntax': ['scss', 'html'],
      \'initial_indent': ['script.javascript', 'style', 'yaml'],
      \'attribute': 1,
      \'keyword': 1,
      \'foldexpr': 1,
      \}

And the result is this: template, script, data(), methods, etc. are shrunk, what variable did that do? What are the keyboard shortcuts to show and hide again?

PS.: Sorry for the bad information, I really don't know what it is.

leafOfTree commented 3 years ago

Hi, thanks for your information. Do you mean that the template, script, etc are folded by are shrunk?

Screen Shot 2021-05-10 at 1 20 48 PM

If so, that's because foldexpr sets foldenable. I removed this in the latest commit https://github.com/leafOfTree/vim-vue-plugin/commit/b8cbd66359006f38446b0a92fd5a0aaaf4480a9c. Also see :h foldenable, :h za

So you could

felipe-heredia commented 3 years ago

I like this feature, did you remove it? If you haven't removed it, I would like to know what the shortcuts are to shrink and show again.

leafOfTree commented 3 years ago

No, the feature is still there. You can shrink and show it by za in normal mode. Only the setting about foldenable was removed.

felipe-heredia commented 3 years ago

ZA is a standard feature of Vim and not the plugin, is that it? ZA solved my problem, but I'm a new vim user.

leafOfTree commented 3 years ago

Exactly. You could check it out by :help za. :help is very helpful at all times.

felipe-heredia commented 3 years ago

Alright, exists an global variable to enable folderxpr? Similar to 'let g:vim_vue_plugin_use_scss'

leafOfTree commented 3 years ago

As you see, all config variables have been moved to g:vim_vue_plugin_config, but you can still toggle it as if it's a global variable let g:vim_vue_plugin_config.foldexpr = 1

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

let g:vim_vue_plugin_config.foldexpr = 1