mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-08 21:54:46 +08:00
Highlight keywords with required indent
This commit is contained in:
@@ -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_stylus = vue#GetConfig("use_stylus", 0)
|
||||||
let s:use_coffee = vue#GetConfig("use_coffee", 0)
|
let s:use_coffee = vue#GetConfig("use_coffee", 0)
|
||||||
let s:use_typescript = vue#GetConfig("use_typescript", 0)
|
let s:use_typescript = vue#GetConfig("use_typescript", 0)
|
||||||
|
let s:has_init_indent = vue#GetConfig("has_init_indent",
|
||||||
let s:has_init_indent = 0
|
\ expand("%:e") == 'wpy' ? 1 : 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
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0)
|
let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0)
|
||||||
|
|
||||||
if !s:highlight_vue_keyword | finish | endif
|
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 = '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*:/'
|
execute 'syntax match vueObjectKey /'.s:vue_keywords_regexp.'\s*:/'
|
||||||
\.' containedin=jsObject,javascriptVueScript'
|
\.' containedin=jsObject,javascriptVueScript'
|
||||||
\.' skipwhite skipempty nextgroup=jsObjectValue'
|
\.' skipwhite skipempty nextgroup=jsObjectValue'
|
||||||
|
|||||||
Reference in New Issue
Block a user