mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-09 22:25:12 +08:00
Update doc
This commit is contained in:
36
README.md
36
README.md
@@ -35,7 +35,7 @@ Vim syntax and indent plugin for `.vue` files. Mainly inspired by [mxw/vim-jsx][
|
|||||||
<br />
|
<br />
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
This plugin works if `filetype` is set to `vue`. Please stay up to date. Feel free to open an issue or pull request.
|
This plugin works if it has set `filetype` to `vue`. Please stay up to date. Feel free to open an issue or pull request.
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
@@ -109,23 +109,25 @@ This plugin provides functions to get the tag/subtype where the cursor is in.
|
|||||||
|
|
||||||
- `GetVueSubtype() => String` Return value is one of `'html', 'javascript', 'css', 'scss', ...`.
|
- `GetVueSubtype() => String` Return value is one of `'html', 'javascript', 'css', 'scss', ...`.
|
||||||
|
|
||||||
You can also define an event listener function `OnChangeVueSubtype(subtype)` in your `vimrc` to get the subtype and set its local options whenever it changes.
|
- `OnChangeVueSubtype(subtype)` An event listener that is called when subtype changes.
|
||||||
|
|
||||||
```vim
|
You can also define an event listener function `OnChangeVueSubtype(subtype)` in your `vimrc` to get the subtype and set its local options whenever it changes.
|
||||||
" Example: set local options based on subtype
|
|
||||||
function! OnChangeVueSubtype(subtype)
|
```vim
|
||||||
echom 'Subtype is '.a:subtype
|
" Example: set local options based on subtype
|
||||||
if a:subtype == 'html'
|
function! OnChangeVueSubtype(subtype)
|
||||||
setlocal commentstring=<!--%s-->
|
echom 'Subtype is '.a:subtype
|
||||||
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
|
if a:subtype == 'html'
|
||||||
elseif a:subtype =~ 'css'
|
setlocal commentstring=<!--%s-->
|
||||||
setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
|
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
|
||||||
else
|
elseif a:subtype =~ 'css'
|
||||||
setlocal commentstring=//%s
|
setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
else
|
||||||
endif
|
setlocal commentstring=//%s
|
||||||
endfunction
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||||
```
|
endif
|
||||||
|
endfunction
|
||||||
|
```
|
||||||
|
|
||||||
### emmet-vim
|
### emmet-vim
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user