From 6e25aaf38819fe2706c6d402d9187aad5dccb7a5 Mon Sep 17 00:00:00 2001 From: leafOfTree Date: Fri, 13 Aug 2021 16:47:13 +0800 Subject: [PATCH] Fix syntax sync being cleared issue --- syntax/vue.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/syntax/vue.vim b/syntax/vue.vim index f35ae71..fefe328 100644 --- a/syntax/vue.vim +++ b/syntax/vue.vim @@ -2,8 +2,12 @@ " Maintainer: leaf " Credits: Inspired by mxw/vim-jsx. -if exists('b:current_syntax') && b:current_syntax == 'vue' - finish +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' endif " is replaced with the file name of the sourced file @@ -201,10 +205,14 @@ function! s:SetExtraSyntax() call s:SetCurrentSyntax() endfunction -function! s:ClearTimerVariable() +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(...) @@ -213,7 +221,7 @@ function! VimVuePluginSyntaxMain(...) let syntax_list = vue#GetSyntaxList(s:config_syntax) call s:LoadSyntaxList(syntax_list) call s:SetExtraSyntax() - call s:ClearTimerVariable() + call s:PostSetting() endfunction " Entry