mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-23 12:36:53 -07:00
Fix #410 - Do not load irrelevant syntax files
This commit is contained in:
parent
8d4c341a0a
commit
ffd54224a0
8
plug.vim
8
plug.vim
@ -411,7 +411,7 @@ function! s:remove_triggers(name)
|
|||||||
call remove(s:triggers, a:name)
|
call remove(s:triggers, a:name)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod(names, types)
|
function! s:lod(names, types, ...)
|
||||||
for name in a:names
|
for name in a:names
|
||||||
call s:remove_triggers(name)
|
call s:remove_triggers(name)
|
||||||
let s:loaded[name] = 1
|
let s:loaded[name] = 1
|
||||||
@ -423,6 +423,9 @@ function! s:lod(names, types)
|
|||||||
for dir in a:types
|
for dir in a:types
|
||||||
call s:source(rtp, dir.'/**/*.vim')
|
call s:source(rtp, dir.'/**/*.vim')
|
||||||
endfor
|
endfor
|
||||||
|
for file in a:000
|
||||||
|
call s:source(rtp, file)
|
||||||
|
endfor
|
||||||
if exists('#User#'.name)
|
if exists('#User#'.name)
|
||||||
execute 'doautocmd User' name
|
execute 'doautocmd User' name
|
||||||
endif
|
endif
|
||||||
@ -430,7 +433,8 @@ function! s:lod(names, types)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_ft(pat, names)
|
function! s:lod_ft(pat, names)
|
||||||
call s:lod(a:names, ['plugin', 'after/plugin', 'syntax', 'after/syntax'])
|
let syn = 'syntax/'.a:pat.'.vim'
|
||||||
|
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
||||||
execute 'autocmd! PlugLOD FileType' a:pat
|
execute 'autocmd! PlugLOD FileType' a:pat
|
||||||
if exists('#filetypeplugin#FileType')
|
if exists('#filetypeplugin#FileType')
|
||||||
doautocmd filetypeplugin FileType
|
doautocmd filetypeplugin FileType
|
||||||
|
@ -935,6 +935,7 @@ Execute (Filetype-based on-demand loading):
|
|||||||
call ReloadPlug()
|
call ReloadPlug()
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
||||||
|
Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||||
@ -942,6 +943,10 @@ Execute (Filetype-based on-demand loading):
|
|||||||
setf 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', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
||||||
|
|
||||||
|
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
||||||
|
setf yyy
|
||||||
|
AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'yyy/plugin', 'yyy/after/plugin'], g:yyy
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
@ -992,6 +997,8 @@ Execute (PlugStatus should not contain (not loaded)):
|
|||||||
q
|
q
|
||||||
|
|
||||||
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
||||||
|
call ResetPlug()
|
||||||
|
unlet! g:yyy
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
Loading…
Reference in New Issue
Block a user