mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-08 05:34:44 +08:00
Load syntax and then set syntax to fix syntax sync
This commit is contained in:
@@ -45,6 +45,9 @@ syntax region VueExpression
|
||||
\ transparent
|
||||
\ start="{{"
|
||||
\ end="}}"
|
||||
|
||||
" Just to avoid error when using pattern in containedin
|
||||
syntax match htmlTemplateBlock /htmlTemplateBlock/
|
||||
syntax region VueExpression
|
||||
\ containedin=VueValue,htmlString,htmlValue,.*TemplateBlock,html.*Block
|
||||
\ contains=@simpleJavascriptExpression
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
" Maintainer: leaf <https://github.com/leafOfTree>
|
||||
" Credits: Inspired by mxw/vim-jsx.
|
||||
|
||||
if !exists('g:main_syntax')
|
||||
if exists('b:current_syntax') && b:current_syntax == 'vue'
|
||||
finish
|
||||
endif
|
||||
" Prevent 'syntax sync' from being cleared
|
||||
let g: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
|
||||
@@ -41,6 +37,7 @@ function! s:GetGroupNameForHighlight(syntax)
|
||||
return name
|
||||
endfunction
|
||||
|
||||
" Return name with format '<syntax><Tagname>Block'
|
||||
function! s:GetSynatxName(block, syntax)
|
||||
let block = a:block
|
||||
let syntax = a:syntax
|
||||
@@ -209,17 +206,13 @@ function! s:PostSetting()
|
||||
if exists('s:main_timer')
|
||||
unlet s:main_timer
|
||||
endif
|
||||
|
||||
if exists('g:main_syntax') && g:main_syntax == 'vue'
|
||||
unlet g:main_syntax
|
||||
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:SetBlockSyntax(s:config_syntax)
|
||||
call s:SetExtraSyntax()
|
||||
call s:PostSetting()
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user