mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-10-15 18:42:45 +08:00
Add option to highlight vue keywords
This commit is contained in:
1 parent
bf0441f48c
commit
6c09d4787b
4 files changed
+42
-3
No files matched your search
+1
-1
@@ -5,7 +5,7 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let s:highlight_vue_attr = exists("g:vim_vue_plugin_highlight_vue_attr")
|
||||
\ && g:vim_vue_plugin_highlight_vue_attr == 1
|
||||
")}}}
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"
|
||||
" Config {{{
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let s:highlight_vue_keyword = exists("g:vim_vue_plugin_highlight_vue_keyword")
|
||||
\ && g:vim_vue_plugin_highlight_vue_keyword == 1
|
||||
|
||||
if !s:highlight_vue_keyword | finish | endif
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"
|
||||
" Syntax highlight {{{
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
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 = join(split(s:vue_keywords, ' '), '|')
|
||||
execute 'syntax match vueObjectKey /\v<('.s:vue_keywords_regexp.')\ze\s*:/'
|
||||
\.' containedin=jsObject,javascriptVueScript'
|
||||
\.' skipwhite skipempty nextgroup=jsObjectValue'
|
||||
|
||||
execute 'syntax match vueObjectFuncName /\v<('.s:vue_keywords_regexp.')\ze\_s*\(/'
|
||||
\.' containedin=jsObject,javascriptVueScript'
|
||||
\.' skipwhite skipempty nextgroup=jsFuncArgs'
|
||||
|
||||
execute 'syntax match vueObjectFuncKey /\v<('.s:vue_keywords_regexp.')\ze\s*:\s*function>/'
|
||||
\.' containedin=jsObject,javascriptVueScript'
|
||||
\.' skipwhite skipempty nextgroup=jsFuncArgs'
|
||||
|
||||
highlight default link vueObjectKey Constant
|
||||
highlight default link vueObjectFuncName Constant
|
||||
highlight default link vueObjectFuncKey Constant
|
||||
"}}}
|
||||
@@ -102,6 +102,9 @@ if hlexists('javaScriptComment') == 0
|
||||
call vue#Log('load javascript cluster')
|
||||
call s:LoadSyntax('@htmlJavaScript', 'javascript')
|
||||
endif
|
||||
|
||||
" Load vue-javascript syntax
|
||||
runtime syntax/vue-javascript.vim
|
||||
"}}}
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Reference in new issue
Block a user