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

Do not source when the plugin has been sourced #35

Merged
merged 1 commit into from
Mar 11, 2016
Merged

Do not source when the plugin has been sourced #35

merged 1 commit into from
Mar 11, 2016

Conversation

lambdalisue
Copy link
Contributor

's:source_plugin' possibly called twice or more when the plugin is depended from several plugins.
This commit simply skip if the plugin is already sourced, to prevent unnecessary function call and
&runtimepath duplication.

's:source_plugin' possibly called twice or more when the plugin is depended from several plugins.
This commit simply skip if the plugin is already sourced, to prevent unnecessary function call and
&runtimepath duplication.
@@ -167,6 +167,9 @@ function! dein#autoload#_dummy_complete(arglead, cmdline, cursorpos) abort "{{{
endfunction"}}}

function! s:source_plugin(rtps, index, plugin) abort "{{{
if a:plugin.sourced
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not really sure that I should use get(a:plugin, 'sourced') or not.
While dein.vim care about the startup speed, I just use a:plugin.source but if a:plugin could be an empty dictionary, it should be get(a:plugin, 'sourced') and I'll fix it then ;-)

@lambdalisue
Copy link
Contributor Author

Before this patch

EchoRuntimePath:
/home/alisue/.config/nvim
/etc/xdg/xdg-gnome/nvim
/etc/xdg/nvim
/home/alisue/.local/share/nvim/site
/usr/share/gnome/nvim/site
/usr/local/share/nvim/site
/home/alisue/.vim/bundle/repos/github.com/thinca/vim-quickrun
/home/alisue/.vim/bundle/repos/github.com/haya14busa/incsearch.vim
/home/alisue/.vim/bundle/repos/github.com/tyru/capture.vim
/home/alisue/.vim/bundle/local/vim-gita
/home/alisue/.vim/bundle/repos/github.com/Shougo/vimfiler.vim
/home/alisue/.vim/bundle/repos/github.com/cohama/agit.vim
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista-unite
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista
/home/alisue/.vim/bundle/repos/github.com/Shougo/neomru.vim
/home/alisue/.vim/bundle/repos/github.com/thinca/vim-qfreplace
/home/alisue/.vim/bundle/repos/github.com/rafi/vim-unite-issue
/home/alisue/.vim/bundle/repos/github.com/tyru/open-browser.vim
/home/alisue/.vim/bundle/repos/github.com/mattn/webapi-vim
/home/alisue/.vim/bundle/repos/github.com/MattesGroeger/vim-bookmarks
/home/alisue/.vim/bundle/repos/github.com/cohama/agit.vim
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista-unite
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista
/home/alisue/.vim/bundle/repos/github.com/Shougo/neomru.vim
/home/alisue/.vim/bundle/repos/github.com/thinca/vim-qfreplace
/home/alisue/.vim/bundle/repos/github.com/rafi/vim-unite-issue
/home/alisue/.vim/bundle/repos/github.com/tyru/open-browser.vim
/home/alisue/.vim/bundle/repos/github.com/mattn/webapi-vim
/home/alisue/.vim/bundle/repos/github.com/Shougo/unite.vim
/home/alisue/.vim/bundle/repos/github.com/Shougo/neosnippet.vim
/home/alisue/.vim/bundle/repos/github.com/Shougo/context_filetype.vim
/home/alisue/.vim/bundle/repos/github.com/Shougo/neosnippet-snippets
/home/alisue/.vim/bundle/repos/github.com/Shougo/unite.vim
/home/alisue/.vim/bundle/.dein
/usr/share/nvim/site
/usr/share/nvim/runtime
/usr/share/nvim/site/after
/usr/local/share/nvim/site/after
/usr/share/gnome/nvim/site/after
/home/alisue/.local/share/nvim/site/after
/etc/xdg/nvim/after
/etc/xdg/xdg-gnome/nvim/after
/home/alisue/.config/nvim/after
/home/alisue/.vim
/home/alisue/.vim/bundle/repos/dein.vim
/home/alisue/.vim/bundle/.dein/after

After this patch

/home/alisue/.config/nvim
/etc/xdg/xdg-gnome/nvim
/etc/xdg/nvim
/home/alisue/.local/share/nvim/site
/usr/share/gnome/nvim/site
/usr/local/share/nvim/site
/home/alisue/.vim/bundle/repos/github.com/thinca/vim-quickrun
/home/alisue/.vim/bundle/repos/github.com/haya14busa/incsearch.vim
/home/alisue/.vim/bundle/local/vim-gita
/home/alisue/.vim/bundle/repos/github.com/Shougo/vimfiler.vim
/home/alisue/.vim/bundle/repos/github.com/cohama/agit.vim
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista-unite
/home/alisue/.vim/bundle/repos/github.com/lambdalisue/vim-gista
/home/alisue/.vim/bundle/repos/github.com/Shougo/neomru.vim
/home/alisue/.vim/bundle/repos/github.com/thinca/vim-qfreplace
/home/alisue/.vim/bundle/repos/github.com/rafi/vim-unite-issue
/home/alisue/.vim/bundle/repos/github.com/tyru/open-browser.vim
/home/alisue/.vim/bundle/repos/github.com/MattesGroeger/vim-bookmarks
/home/alisue/.vim/bundle/repos/github.com/Shougo/neosnippet.vim
/home/alisue/.vim/bundle/repos/github.com/Shougo/unite.vim
/home/alisue/.vim/bundle/repos/github.com/tyru/capture.vim
/home/alisue/.vim/bundle/.dein
/usr/share/nvim/site
/usr/share/nvim/runtime
/usr/share/nvim/site/after
/usr/local/share/nvim/site/after
/usr/share/gnome/nvim/site/after
/home/alisue/.local/share/nvim/site/after
/etc/xdg/nvim/after
/etc/xdg/xdg-gnome/nvim/after
/home/alisue/.config/nvim/after
/home/alisue/.vim
/home/alisue/Code/github.com/lambdalisue/dein.vim
/home/alisue/.vim/bundle/.dein/after

@lambdalisue
Copy link
Contributor Author

It seems this change cause the following exception on startup. I'll fix and re-PR

Error detected while processing function <SNR>3_configure[13]..dein#local[1]..dein#parse#_local[24]..dein#add[1]..dein#parse#_add[1]..dein#parse#_dict:
line   69:
E909: Cannot index a special variable
E15: Invalid expression: plugin.rtp[0:] == '~'

@lambdalisue
Copy link
Contributor Author

No. It seems that exception is not because of this PR (the exception could be shown even in 64397f6). It because of the following line in my plugin.toml

[[plugins]]
repo = 'Shougo/dein.vim'
rtp  = ''

This is completely different issue so I re-PR.

@lambdalisue lambdalisue reopened this Mar 11, 2016
@symbolix
Copy link

@lambdalisue Hi, is this plugin.toml part of dein.vim or is it your custom setup? I am curious to see how the TOML plugin config is implemented. Thanks.

@Shougo
Copy link
Owner

Shougo commented Mar 11, 2016

@lambdalisue Hi, is this plugin.toml part of dein.vim or is it your custom setup? I am curious to see how the TOML plugin config is implemented. Thanks.

dein.vim can parse the TOML config.

Shougo added a commit that referenced this pull request Mar 11, 2016
Do not source when the plugin has been sourced
@Shougo Shougo merged commit ad363a4 into Shougo:master Mar 11, 2016
@lambdalisue lambdalisue deleted the fix/runtimepath_duplication branch March 11, 2016 11:12
@lambdalisue
Copy link
Contributor Author

Thanks ;-)

@Shougo
Copy link
Owner

Shougo commented Mar 11, 2016

OK, thanks.

@lambdalisue
Copy link
Contributor Author

Is rtp = '' bug or did you drop this feature? @Shougo (Or my configuration problem)

@Shougo
Copy link
Owner

Shougo commented Mar 11, 2016

@lambdalisue It seems Vim's bug.
Please create new issue. I will check it.

@lambdalisue
Copy link
Contributor Author

Ok. I'll do

@lambdalisue
Copy link
Contributor Author

Ok. I couldn't reproduce that anymore. Maybe my configuration was wrong during development. I'm sorry for bothering you.

@Shougo
Copy link
Owner

Shougo commented Mar 11, 2016

Oh, ... Hm

@symbolix
Copy link

@lambdalisue @Shougo Yeah, I know the TOML parser is implemented both in neobundle and dein. However, could you please point me to an example TOML plugin config file and possibly a simple dein.vim implementation. Thank you very much. I am already migrating to dein.vim from Neobundle.

@Shougo
Copy link
Owner

Shougo commented Mar 11, 2016

@symbolix
Copy link

Amazing! Thank you very much!

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

Successfully merging this pull request may close these issues.

3 participants