Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy loading after/syntax/*.vim in plugins #410

Closed
davidjb opened this issue Feb 17, 2016 · 3 comments
Closed

Lazy loading after/syntax/*.vim in plugins #410

davidjb opened this issue Feb 17, 2016 · 3 comments
Assignees
Labels

Comments

@davidjb
Copy link

davidjb commented Feb 17, 2016

A plugin I'm using riv.vim is having all after/sytax/*.vim files included by vim-plug when I'm using lazy loading by filetype. My particular issue comes up with:

Plug 'Rykka/riv.vim', { 'for': 'rst' }
let g:riv_python_rst_hl = 1

This causes all the after/syntax/*.vim (eg both python.vim and rst.vim files in its after/syntax folder) to be sourced by vim-plug when opening an .rst file. The second line is needed to enable rst syntax in Python files (and pass a check in its after/syntax/python.vim). The result of sourcing both files is that python.vim also sources rst.vim; resulting in a double-inclusion of rst.vim (which raises an error down the line).

If not using lazy loading, there's no issue as only the after/syntax/rst.vim gets sourced on file open. The globbing at https://github.com/junegunn/vim-plug/blob/master/plug.vim#L424, which is called by line 433, is sourcing all files in a plugin's after/syntax directory.

So, should vim-plug only source the after/syntax/<filetype>.vim when lazy-loading, or is this something riv.vim should be guarding against?

I'm using the latest version of vim-plug with VIM - Vi IMproved 7.4 patches: 1-712 on Ubuntu 15.10.

Thanks!

@junegunn
Copy link
Owner

Thanks for the report. We should fix this.

@junegunn junegunn added the bug label Feb 17, 2016
@davidjb
Copy link
Author

davidjb commented Feb 17, 2016

@junegunn Okay, so this would apply to both syntax and after/syntax directories referenced in s:lod_ft. This should give a boost performance as you're only parsing the syntax of the given filetype.

@junegunn junegunn self-assigned this Feb 17, 2016
@davidjb
Copy link
Author

davidjb commented Feb 17, 2016

Thanks @junegunn, works perfectly.

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

No branches or pull requests

2 participants