diff --git a/syntax/patch/html.vim b/syntax/patch/html.vim index 31ad37c..184b00b 100644 --- a/syntax/patch/html.vim +++ b/syntax/patch/html.vim @@ -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 diff --git a/syntax/vue.vim b/syntax/vue.vim index fefe328..273d289 100644 --- a/syntax/vue.vim +++ b/syntax/vue.vim @@ -2,12 +2,8 @@ " Maintainer: leaf " 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 " 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 '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