Hi Vim devs,

A recent patch seems to have changed the behavior of how my plugins load. In 
particular, it looks like plugin files in pack/*/start/*/plugin/*.vim are 
loaded twice.

I'm fairly sure this is an effect of patch 8.0.0612 
(https://github.com/vim/vim/commit/ce876aaa9a250a5a0d0e34b3a2625e51cf9bf5bb).

It looks like
  add_pack_start_dirs()
adds the plugin packs' roots to the runtimepath, then the existing code calls
  source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER);
which both loads the old-style plugins (like ~/.vim/plugin/*) and the 
pack-style plugins, since their paths are already in the runtimepath. Then, a 
few lines below, we call
  load_start_packages()
which loads the pack-style plugins again.

The behavior can be seen by making a simple file with the contents
echom expand('<sfile>')
and putting a copy in two places:
  ~/.vim/plugin/echoer.vim
  ~/.vim/pack/echoer/start/echoer/plugin/echoer.vim

I mostly use MacVim from homebrew. This MacVim doesn't show this behavior:
$ /usr/local/Cellar/macvim/8.0-132/bin/mvim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May  6 2017 12:47:23)
MacOS X (unix) version
Included patches: 1-596
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +find_in_path    -mouse_sysmouse  -tag_any_white
+arabic          +float           +mouse_urxvt     +tcl
+autocmd         +folding         +mouse_xterm     +termguicolors
+balloon_eval    -footer          +multi_byte      +terminfo
+browse          +fork()          +multi_lang      +termresponse
...

This MacVim *does* show the double-loading behavior:
$ /usr/local/Cellar/macvim/8.0-134/bin/mvim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 22 2017 07:10:35)
MacOS X (unix) version
Included patches: 1-648
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +find_in_path    -mouse_sysmouse  -tag_any_white
+arabic          +float           +mouse_urxvt     +tcl
+autocmd         +folding         +mouse_xterm     +termguicolors
+balloon_eval    -footer          +multi_byte      +terminfo
+browse          +fork()          +multi_lang      +termresponse
...

I can also observe the double-loading behavior in this Linux build of vim:
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 21 2017 16:46:43)
Included patches: 1-627
Big version with GTK2 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
...

-----

If this behavior is works-as-designed and/or I should be looking into making my 
plugin files resilient to being loaded a second time, please let me know.

Thanks for your help,
Mike

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui