Open blueyed opened 7 years ago
Thanks. I haven't looked closely into the issue yet, but
but for some reason that is not happening during the tests, although the autocommand is there?!
would using nested autocmd in https://github.com/junegunn/vim-plug/blob/5fc9eab788608fb4adcb07a8d79354dcafefaa6a/plug.vim#L270 help?
When a plugin has a
after/syntax/lua.vim
file, and this plugin gets loaded'for': ['lua']
, the main syntax plugin(s) (syntax/lua.vim
) will not be loaded, whenb:current_syntax
might exist already.In the case of https://github.com/raymond-w-ko/vim-lua-indent/blob/master/after/syntax/lua.vim#L7 this relies on a variable
lua_version
being set, but it gets not set from Vim'ssyntax/lua.vim
whenb:current_syntax
is set already.TEST CASE:
config.ld
file, it will haveft=ld
andb:current_syntax='ld'
set ft=lua
(manually or through a modeline)vim-plug will call
runtime syntax/lua.vim
, but that finishes, becauseb:current_syntax
is set to'ld'
already. Thenafter/syntax/lua.vim
from the plugin gets sourced, and throws an error because of the unknown var.I've noticed that passing in
, syn, 'after/'.syn
tos:lod
will even cause it to be loaded twice in the end?!So the following would actually fix it for this use case, but breaks the "Filetype-based on-demand loading" test (
'xxx/syntax', 'xxx/after/syntax'
is missing fromg:xxx
).When testing it manually, the
syntaxset
FileType event will trigger the syntax files to be loaded automatically, but for some reason that is not happening during the tests, although the autocommand is there?!A test case (
t/minimal.vim
):With
p1/after/syntax/lua.vim
:Then run it with
vim -Nu minimal.vim t.ld
and callset ft=lua
in Vim:A fix for this might be to
unlet! b:current_syntax
ins:lod_ft
, but then it will (still) cause the syntax files to be sourced twice - which seems to be wrong in the first place?!