diff --git a/.gitignore b/.gitignore index 4d4d57c..7c02170 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ README.html test.vue .DS_STORE test/deps/ +doc/tags diff --git a/README.md b/README.md index 8cd49e8..4a77d49 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Vim syntax and indent plugin for `.vue` files. Mainly inspired by [mxw/vim-jsx][ 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 +See `:help vim-vue-plugin` for the documentation in Vim. +
How to install @@ -92,6 +94,7 @@ It has the following options - `lang="..."` on block tag decides the effective syntax - When no valid `lang="..."` is present, the first syntax in the list will be used. - By default, only syntax files from `['$VIMRUNTIME', '$VIM/vimfiles', '$HOME/.vim']` are loaded. If none is found, then **full** syntax files, including those from plugins, will be loaded + - Each key replaces the default of the same key, so `{'syntax': {'script': ['javascript', 'typescript']}}` keeps `template` as `['html']` and `style` as `['css']`. Set a key to `[]` to remove the block - **full_syntax**: *string list*. Syntax whose **full** syntax files will always be loaded - **initial_indent**: *string list*. Tag/syntax with initial one tab indent. The format can be `tag.syntax`, `tag`, or `syntax` diff --git a/autoload/vue.vim b/autoload/vue.vim index f4fe80f..714d4bd 100644 --- a/autoload/vue.vim +++ b/autoload/vue.vim @@ -28,10 +28,16 @@ function! s:MergeUserConfigIntoDefault(user) \'debug': 0, \} + " Each key of syntax replaces the default of the same key, so blocks not in + " user config keep their default syntax let user = a:user for key in keys(default) if has_key(user, key) - let default[key] = user[key] + if key ==# 'syntax' && type(user[key]) == v:t_dict + call extend(default[key], user[key]) + else + let default[key] = user[key] + endif endif endfor diff --git a/doc/vim-vue-plugin.txt b/doc/vim-vue-plugin.txt new file mode 100644 index 0000000..e85f85a --- /dev/null +++ b/doc/vim-vue-plugin.txt @@ -0,0 +1,166 @@ +*vim-vue-plugin.txt* Syntax and indent for Vue files + +Author: leafOfTree +License: The Unlicense + +============================================================================== +CONTENTS *vim-vue-plugin-contents* + + 1. Introduction ............................... |vim-vue-plugin-intro| + 2. Configuration .............................. |vim-vue-plugin-config| + 3. Functions .................................. |vim-vue-plugin-functions| + 4. Avoid overload ............................. |vim-vue-plugin-overload| + +============================================================================== +1. Introduction *vim-vue-plugin-intro* + +Vim syntax and indent plugin for `.vue` files, also `.wpy` files. It loads +multiple syntax and indent files for `.vue` and enables them to work +together, with + +- Blocks, both