mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-11-02 18:37:34 +08:00
Update README
- 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
This commit is contained in:
1 file changed
+6
-13
@@ -14,7 +14,7 @@ Vim syntax and indent plugin for `.vue` files. Mainly inspired by [mxw/vim-jsx][
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
You could install it just like other plugins. The filetype will be set to `vue`. Feel free to open an issue or a pull request if any questions
|
You could install it just like other plugins. The filetype will be set to `vue`. It's tested with Vim 8.2+ and Neovim 0.9+. Feel free to open an issue or a pull request if any questions
|
||||||
|
|
||||||
See `:help vim-vue-plugin` for the documentation in Vim.
|
See `:help vim-vue-plugin` for the documentation in Vim.
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ It loads multiple syntax and indent files for `.vue` and enables them to work to
|
|||||||
`g:vim_vue_plugin_config` is the only configuration. You can copy its **default value** below as a starting point
|
`g:vim_vue_plugin_config` is the only configuration. You can copy its **default value** below as a starting point
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:vim_vue_plugin_config = {
|
let g:vim_vue_plugin_config = {
|
||||||
\'syntax': {
|
\'syntax': {
|
||||||
\ 'template': ['html'],
|
\ 'template': ['html'],
|
||||||
\ 'script': ['javascript'],
|
\ 'script': ['javascript'],
|
||||||
@@ -110,7 +110,7 @@ For *boolean* options below, set `1` to enable or `0` to disable
|
|||||||
Only for demo. Try to set syntax as little as possible for performance.
|
Only for demo. Try to set syntax as little as possible for performance.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:vim_vue_plugin_config = {
|
let g:vim_vue_plugin_config = {
|
||||||
\'syntax': {
|
\'syntax': {
|
||||||
\ 'template': ['html', 'pug'],
|
\ 'template': ['html', 'pug'],
|
||||||
\ 'script': ['javascript', 'typescript', 'coffee'],
|
\ 'script': ['javascript', 'typescript', 'coffee'],
|
||||||
@@ -150,7 +150,7 @@ There are more than one language in `.vue` file. Different mappings, completions
|
|||||||
|
|
||||||
This plugin provides functions to get the tag/syntax where the cursor is in
|
This plugin provides functions to get the tag/syntax where the cursor is in
|
||||||
|
|
||||||
- `GetVueTag() => String` Return value is one of `'template', 'script', 'style'`
|
- `GetVueTag([lnum]) => String` Return value is the block tag like `'template', 'script', 'style'`, or `''`, at line `lnum` or the cursor line
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Example
|
" Example
|
||||||
@@ -196,7 +196,7 @@ For `sass` using emmet-vim, please check out [this issue][17]
|
|||||||
|
|
||||||
Since there are many sub-languages included, most delays come from syntax files overload. A variable named `b:current_loading_main_syntax` is set to `vue` which can be used as a loading condition if you'd like to manually find and modify the syntax files causing overload
|
Since there are many sub-languages included, most delays come from syntax files overload. A variable named `b:current_loading_main_syntax` is set to `vue` which can be used as a loading condition if you'd like to manually find and modify the syntax files causing overload
|
||||||
|
|
||||||
For example, the built-in syntax `sass.vim` and `less.vim` in vim8.1 runtime and `pug.vim` in vim-pug/syntax always load `css.vim` which this plugin already loads. It can be optimized like
|
For example, the built-in syntax `sass.vim` and `less.vim` in Vim runtime and `pug.vim` in vim-pug/syntax always load `css.vim` which this plugin already loads. It can be optimized like
|
||||||
|
|
||||||
`$VIMRUNTIME/syntax/sass.vim`
|
`$VIMRUNTIME/syntax/sass.vim`
|
||||||
```diff
|
```diff
|
||||||
@@ -206,14 +206,6 @@ For example, the built-in syntax `sass.vim` and `less.vim` in vim8.1 runtime and
|
|||||||
+ endif
|
+ endif
|
||||||
```
|
```
|
||||||
|
|
||||||
`$VIMRUNTIME/syntax/vue.vim`
|
|
||||||
```diff
|
|
||||||
- runtime! syntax/html.vim
|
|
||||||
+ if !exists("b:current_loading_main_syntax")
|
|
||||||
+ runtime! syntax/html.vim
|
|
||||||
+ endif
|
|
||||||
```
|
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
Run tests with Vim and Neovim, whichever is installed
|
Run tests with Vim and Neovim, whichever is installed
|
||||||
@@ -222,6 +214,7 @@ Run tests with Vim and Neovim, whichever is installed
|
|||||||
./test/run.sh
|
./test/run.sh
|
||||||
./test/run.sh basic template # Only these cases
|
./test/run.sh basic template # Only these cases
|
||||||
VUE_TEST_EDITORS=nvim ./test/run.sh # Only Neovim
|
VUE_TEST_EDITORS=nvim ./test/run.sh # Only Neovim
|
||||||
|
./test/shared.sh # Compare shared-* cases with vim-svelte-plugin
|
||||||
```
|
```
|
||||||
|
|
||||||
Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an optional `.vim` file for the config and checks. A case fails if
|
Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an optional `.vim` file for the config and checks. A case fails if
|
||||||
|
|||||||
Reference in new issue
Block a user