Reputation: 33
Sometimes Vim plugins suggest a load order, but Vim nowaday natively supports loading plugins with no plugin manager. You just put a submodule in a folder such as ~/.vim/pack/vendor/start
and it'll automatically load. So, my question is how do you ensure a load order similar to how people would previously. Older way of doing things example below:
Plug 'preservim/nerdtree' |
\ Plug 'Xuyuanp/nerdtree-git-plugin' |
\ Plug 'ryanoasis/vim-devicons'
Taken from https://github.com/Xuyuanp/nerdtree-git-plugin#faq.
Upvotes: 3
Views: 984
Reputation: 196856
Let's try a little experiment…
Create the following dummy files with their corresponding content:
Filepath | Content |
---|---|
pack/dummy/start/nerdtree/plugin/foo.vim |
echom "nerdtree" |
pack/dummy/start/nerdtree-git-plugin/plugin/bar.vim |
echom "nerdtree-git-plugin" |
pack/dummy/start/vim-devicons/plugin/baz.vim |
echom "vim-devicons" |
Start Vim and you should see something like the following:
$ vim
nerdtree
nerdtree-git-plugin
vim-devicons
Press ENTER or type command to continue
which is consistant with:
:filter dummy scriptnames
40: ~/.vim/pack/dummy/start/nerdtree/plugin/foo.vim
41: ~/.vim/pack/dummy/start/nerdtree-git-plugin/plugin/bar.vim
42: ~/.vim/pack/dummy/start/vim-devicons/plugin/baz.vim
Press ENTER or type command to continue
Based on this experiment, we can conclude that the built-in "package" feature will "load" plugins found in start/
in the filesystem order which happens to be the same as the prescribed order anyway. Of course, your filesystem may order directories differently than mine, so YMMV.
In theory, the :help :packadd
command should allow you to "manage" your plugins from your vimrc
, like you would with a plugin manager. Let's experiment with it…
Rename start/
to opt/
:
pack/dummy/opt/nerdtree/
pack/dummy/opt/nerdtree-git-plugin/
pack/dummy/opt/vim-devicons/
Add the following lines to your vimrc
after any syntax on
or filetype on
line:
packadd! nerdtree
packadd! nerdtree-git-plugin
packadd! vim-devicons
Start Vim:
$ vim
vim-devicons
nerdtree-git-plugin
nerdtree
Press ENTER or type command to continue
What?
Well… I guess you could experiment with ordering, here, until you get the desired order but that reverse order looks like a bug to me.
Upvotes: 4