diff --git a/init.lua b/init.lua index f06caeb4f56..35e28bae98c 100644 --- a/init.lua +++ b/init.lua @@ -976,10 +976,19 @@ do -- require 'kickstart.plugins.neo-tree' -- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps - -- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- NOTE: You can add your own plugins, configuration, etc. in `lua/custom/plugins/*.lua`. -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For independent modules, uncomment the convenience loader: -- require 'custom.plugins' + -- + -- `custom.plugins` automatically loads files from that directory, but their + -- order is unspecified. If plugins depend on each other, keep them in the same + -- file and put their `vim.pack.add()` and `setup()` calls in the required order. + -- + -- If separate modules need a specific order, require them explicitly instead: + -- require 'custom.plugins.colorscheme' + -- require 'custom.plugins.ui' + -- require 'custom.plugins.git' end -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 01e91722fb0..27290873a3f 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,7 +3,8 @@ -- -- See the kickstart.nvim README for more information --- Iterate over all Lua files in the plugins directory and load them +-- Iterate over all Lua files in the plugins directory and load them. +-- `vim.fs.dir()` iteration order is unspecified and must not be relied upon. local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins') for file_name, type in vim.fs.dir(plugins_dir, { follow = true }) do if (type == 'file' or type == 'link') and file_name:match '%.lua$' and file_name ~= 'init.lua' then