Procházet zdrojové kódy

Avoid multiple `syntax enable` during Vim startup

Joshua Priddle před 10 roky
rodič
revize
396c60f24c
2 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. 3 1
      plug.vim
  2. 1 1
      test/workflow.vader

+ 3 - 1
plug.vim

@@ -248,7 +248,9 @@ function! plug#end()
   call s:reorg_rtp()
   filetype plugin indent on
   if has('vim_starting')
-    syntax enable
+    if has('syntax') && !exists('g:syntax_on')
+      syntax enable
+    end
   else
     call s:reload()
   endif

+ 1 - 1
test/workflow.vader

@@ -941,7 +941,7 @@ Execute (Filetype-based on-demand loading):
   AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
 
   setf xxx
-  AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
+  AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent'], g:xxx
 
   " syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
   setf yyy