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