Support vue3 API keywords

This commit is contained in:
leafOfTree
2021-08-13 16:29:57 +08:00
parent ab96ba2585
commit 8d464e9506
4 changed files with 118 additions and 96 deletions

View File

@@ -2,11 +2,8 @@
" Maintainer: leaf <https://github.com/leafOfTree>
" Credits: Inspired by mxw/vim-jsx.
if !exists('main_syntax')
if exists('b:current_syntax') && b:current_syntax == 'vue'
finish
endif
let main_syntax = 'vue'
if exists('b:current_syntax') && b:current_syntax == 'vue'
finish
endif
" <sfile> is replaced with the file name of the sourced file
@@ -194,23 +191,39 @@ function! s:SetIsKeyword()
endif
endfunction
function! s:SetCurrentSyntax()
let b:current_syntax = 'vue'
endfunction
function! s:SetExtraSyntax()
call s:SetIsKeyword()
call s:HighlightVue()
call s:SetCurrentSyntax()
endfunction
function! s:ClearTimerVariable()
if exists('s:main_timer')
unlet s:main_timer
endif
endfunction
function! VimVuePluginSyntaxMain(...)
call s:Init()
call s:SetBlockSyntax(s:config_syntax)
let syntax_list = vue#GetSyntaxList(s:config_syntax)
call s:LoadSyntaxList(syntax_list)
call s:SetIsKeyword()
call s:HighlightVue()
call s:SetExtraSyntax()
call s:ClearTimerVariable()
endfunction
" Entry
let s:timer = exists('*timer_start') && !exists('SessionLoad') && !s:test
if s:timer
call timer_start(1, 'VimVuePluginSyntaxMain')
if !exists('s:main_timer')
let s:main_timer = timer_start(1, 'VimVuePluginSyntaxMain')
endif
else
call VimVuePluginSyntaxMain()
endif
let b:current_syntax = 'vue'
if main_syntax == 'vue'
unlet main_syntax
endif
call s:SetCurrentSyntax()