Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

default syntax not loaded if lazy loaded by vim-plug #163

Open
unnamed42 opened this issue Dec 31, 2017 · 4 comments
Open

default syntax not loaded if lazy loaded by vim-plug #163

unnamed42 opened this issue Dec 31, 2017 · 4 comments

Comments

@unnamed42
Copy link

As is described in title, vim-plug won't load after/syntax/color_coded.vim if is set to lazy loading, like:

Plug 'jeaye/color_coded', {'for': ['c', 'cpp', 'objc', 'objcpp']}

I've found the code for loading syntax, in plugin/color_coded.vim:

au VimEnter,ColorScheme * source $VIMHOME/after/syntax/color_coded.vim

Maybe both VimEnter and ColorScheme are not captured.

@jeaye
Copy link
Owner

jeaye commented Jan 2, 2018

Hey, @unnamed42. Thanks for creating this issue. I've also experienced problems with lazy loading color_coded and have typically just disabled the lazy loading, so I never looked much into it.

Both VimEnter and ColorScheme are captured there, since we want to reload color_coded whenever the colorscheme changes and we also want to load it on startup (or do we?). Perhaps a better solution is to use another event which only triggers upon the plugin being loaded. I'm not too sure of how to hygienically lazy load plugins at this moment; do you know of some better suited events we should hook instead?

@unnamed42
Copy link
Author

unnamed42 commented Jan 3, 2018

According to the wiki page, when some plugin is lazy loaded, vim-plug will fire a User event whose name is the same as the plugin. So I add a line after syntax loader:

au User color_coded source $VIMHOME/after/syntax/color_coded.vim

And everything looks OK now.

@jeaye
Copy link
Owner

jeaye commented Jan 3, 2018

Wow, great find. We may want to keep all three then. VimEnter, ColorScheme, and User color_coded.

@UnrealQuester
Copy link
Collaborator

Can confirm that this fixes the issue. Do you want to make a PR for this @unnamed42?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants