Improve code and performance

This commit is contained in:
leafOfTree
2021-03-29 15:58:50 +08:00
parent 6b48092f15
commit e1dab23589
4 changed files with 24 additions and 18 deletions

View File

@@ -41,19 +41,19 @@ let s:match_option =
\.' contains='.s:contains
\.' skipwhite skipempty'
execute 'syntax match vueObjectKey /'
execute 'syntax match vueObjectKey display /'
\.s:keywords_regexp
\.'\s*:/'
\.s:match_option
\.' nextgroup=jsObjectValue'
execute 'syntax match vueObjectFuncName /'
execute 'syntax match vueObjectFuncName display /'
\.s:keywords_regexp
\.'\_s*\(/'
\.s:match_option
\.' nextgroup=jsFuncArgs'
execute 'syntax match vueObjectFuncKey /'
execute 'syntax match vueObjectFuncKey display /'
\.s:keywords_regexp
\.'\s*:\s*function>/'
\.s:match_option
@@ -67,7 +67,7 @@ let s:vue3_keywords_regexp = '\v<('
\.join(split(s:vue3_keywords, ' '), '|')
\.')\ze'
execute 'syntax match vue3Keyword /'
execute 'syntax match vue3Keyword display /'
\.s:vue3_keywords_regexp
\.'\_s*\(/'
\.s:match_option

View File

@@ -136,7 +136,7 @@ function! s:HighlightVueTag()
endfunction
function! s:SetSyntaxSync()
syntax sync fromstart
" syntax sync fromstart
endfunction
function! s:SetIsKeyword()
@@ -151,7 +151,7 @@ function! s:SetIsKeyword()
endif
endfunction
function! VimVuePluginSyntaxMain(id)
function! VimVuePluginSyntaxMain(...)
call s:Init()
let syntax_list = vue#GetSyntaxList(s:config_syntax)
call s:LoadSyntaxList(syntax_list)
@@ -161,7 +161,10 @@ function! VimVuePluginSyntaxMain(id)
call s:HighlightVueTag()
endfunction
" call timer_start(10, 'VimVuePluginSyntaxMain')
call VimVuePluginSyntaxMain(0)
if exists('*timer_start')
call timer_start(1, 'VimVuePluginSyntaxMain')
else
call VimVuePluginSyntaxMain()
endif
let b:current_syntax = 'vue'