Skip to content

Inconsistent loading order of packages and their parts #7056

@sheerun

Description

@sheerun

Describe the bug

It seems there is different loading order of plugins and their parts if using empty vimrc / packload / packadd / packadd!

To Reproduce

I've created https://github.com/sheerun/vim-packages-bug that should better illustrate the problem. You can run there bash script.sh to produce following output:

  1. Putting package in ~/.vim/pack/*/start/* without pack commands in ~/.vimrc
loading plugin/*.vim after native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue
  1. Putting package in ~/.vim/pack/*/start/* with packload
loading plugin/*.vim before native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading plugin/*.vim before native vim plugins
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue
  1. Putting package in ~/.vim/pack/*/start/* with packadd vim-packages-bug in vimrc
loading plugin/*.vim before native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading plugin/*.vim before native vim plugins
loading plugin/*.vim after native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue
  1. Putting package in ~/.vim/pack/*/start/* with packadd! vim-packages-bug in vimrc
loading plugin/*.vim before native vim plugins
loading plugin/*.vim after native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue
  1. Putting package in ~/.vim/pack/*/opt/* with packadd vim-packages-bug in vimrc
loading plugin/*.vim before native vim plugins
loading ftdetect/*.vim after native filetype.vim
loading plugin/*.vim before native vim plugins
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue
  1. Putting package in ~/.vim/pack/*/opt/* with packadd! vim-packages-bug in vimrc
loading plugin/*.vim before native vim plugins
loading after/plugin/*.vim after native vim plugins
Press ENTER or type command to continue

To summarize

  1. plugins can be loaded before or after vim plugins, possibly multiple times
  2. ftdetect is loaded always after vim filetypes, possibly multiple times (all other package managers always load ftdetect before vim native files..)
  3. In some cases no part of plugin is loaded before vim parts

Things get even worse if multiple packages are used, because then they can be loaded in alphabetical order (no pack commands), in defined order (packadd commands), or reverse defined order (packadd! commands), and all combinations of these. Order of loading is also affected if some plugins are calling filetype plugin indent on within themselves (like vim-sensible). Also all other package managers are loading filetype.vim of plugin while vim8 packages do not, ever.

Honestly it's pretty overwhelming for someone who would like to depend on some order of loading in package manager (the vim-polyglot plugin I'm developing needs to be loaded before vim's filetype.vim, and other plugins overriding its autocommands).

Environment (please complete the following information):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 16 2020 23:47:44)
macOS version
Included patches: 1-1700
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl              +title
-clientserver      +job               +persistent_undo   -toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               +ruby              +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin -lpython3.8 -framework CoreFoundation  -lruby.2.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions