the new vim.pack config has the convenience loader:
-- require 'custom.plugins'
I think there should also be something about explicit ordering for custom plugin modules where setup order matters:
require 'custom.plugins.colorscheme'
require 'custom.plugins.ui'
require 'custom.plugins.git'
Current code
lua/custom/plugins/init.lua currently auto-loads every Lua file in lua/custom/plugins/:
local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins')
for file_name, type in vim.fs.dir(plugins_dir) do
if type == 'file' and file_name:match '%.lua$' and file_name ~= 'init.lua' then
local module = file_name:gsub('%.lua$', '')
require('custom.plugins.' .. module)
end
end
for independent modules - great. however, since vim.pack plugin files are imperative Lua and may call vim.pack.add, define commands/keymaps, or immediately run setup(), load order can matter.
Suggested change
Update the init.lua to add short blurb about load ordering in vim.pack world:
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
--
-- For independent modules, uncomment this convenience loader:
-- require 'custom.plugins'
--
-- If you have a custom module that depends on another plugin or module being set up first,
-- require modules explicitly in the order they should run:
--
-- require 'custom.plugins.colorscheme'
-- require 'custom.plugins.ui'
-- require 'custom.plugins.git'
the new
vim.packconfig has the convenience loader:-- require 'custom.plugins'I think there should also be something about explicit ordering for custom plugin modules where setup order matters:
Current code
lua/custom/plugins/init.luacurrently auto-loads every Lua file inlua/custom/plugins/:for independent modules - great. however, since
vim.packplugin files are imperative Lua and may callvim.pack.add, define commands/keymaps, or immediately runsetup(), load order can matter.Suggested change
Update the
init.luato add short blurb about load ordering in vim.pack world: