mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-10-03 00:43:46 +08:00
Highlight keywords with required indent
This commit is contained in:
1 parent
069ad44389
commit
9be92aa256
2 files changed
+9
-11
No files matched your search
+2
-10
@@ -40,16 +40,8 @@ let s:use_scss = vue#GetConfig("use_scss", 0)
|
||||
let s:use_stylus = vue#GetConfig("use_stylus", 0)
|
||||
let s:use_coffee = vue#GetConfig("use_coffee", 0)
|
||||
let s:use_typescript = vue#GetConfig("use_typescript", 0)
|
||||
|
||||
let s:has_init_indent = 0
|
||||
if !exists("g:vim_vue_plugin_has_init_indent")
|
||||
let ext = expand("%:e")
|
||||
if ext == 'wpy'
|
||||
let s:has_init_indent = 1
|
||||
endif
|
||||
elseif g:vim_vue_plugin_has_init_indent == 1
|
||||
let s:has_init_indent = 1
|
||||
endif
|
||||
let s:has_init_indent = vue#GetConfig("has_init_indent",
|
||||
\ expand("%:e") == 'wpy' ? 1 : 0)
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0)
|
||||
|
||||
if !s:highlight_vue_keyword | finish | endif
|
||||
|
||||
let s:has_init_indent = vue#GetConfig("has_init_indent",
|
||||
\ expand("%:e") == 'wpy' ? 1 : 0)
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
@@ -15,7 +18,10 @@ if !s:highlight_vue_keyword | finish | endif
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let s:vue_keywords = 'name parent functional delimiters comments components directives filters extends mixins inheritAttrs model props propsData data computed watch methods template render renderError inject provide beforeCreate created beforeMount mounted beforeUpdate updated activated deactivated beforeDestroy destroyed'
|
||||
|
||||
let s:vue_keywords_regexp = '\v<('.join(split(s:vue_keywords, ' '), '|').')\ze'
|
||||
let s:indent = &sw * (1 + s:has_init_indent)
|
||||
let s:vue_keywords_regexp = '\v^\s{'.s:indent.'}<('
|
||||
\.join(split(s:vue_keywords, ' '), '|')
|
||||
\.')\ze'
|
||||
execute 'syntax match vueObjectKey /'.s:vue_keywords_regexp.'\s*:/'
|
||||
\.' containedin=jsObject,javascriptVueScript'
|
||||
\.' skipwhite skipempty nextgroup=jsObjectValue'
|
||||
|
||||
Reference in new issue
Block a user