From 6673c87b2e167495aaeba8a559ca983f99a70320 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Apr 2022 11:01:02 +1000 Subject: [PATCH] feat: Improved documentation of doom.core.modules --- lua/doom/core/README.md | 6 +++++- lua/doom/core/modules.lua | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md index a779307..444fad5 100644 --- a/lua/doom/core/README.md +++ b/lua/doom/core/README.md @@ -6,7 +6,7 @@ The core workings of the doom-nvim framework. - `init.lua` Entrypoint - `doom_global.lua` Sets the `doom` global object including default settings and `use_*` style helper functions. - `config.lua` Responsible for configuring doom-nvim, will use the user's `modules.lua` and `config.lua` -- `modules.lua` Returns the user's `module.lua` file and caches it. Used by `config.lua` to determine which modules to import/configure. +- `modules.lua` Responsible for storing the enabled modules (user's `modules.lua` file) as well as later acting upon `doom.modules` to set everything up. - `functions.lua` Extra helper functions used internally by doom-nvim. - `commands.lua` Extra helper commands used internally by doom-nvim. - `ui.lua` Loads the user's colorscheme from the `doom.colorscheme` field. Falls back to `doom-one` if a colorscheme isn't set or is broken. @@ -23,3 +23,7 @@ Those modules are the following: d. Runs the user's `config.lua` file (so the user can apply their config) e. Applies some of the settings in the `doom` global object such as `doom.indent` 3. `init.lua` loads `functions.lua` and `commands.lua` to set these extra functions/commands. +4. `init.lua` runs the `start`, `load_modules` and `handle_user_config` functions of `modules.lua` which does the following: + a. Install/bootstrap packer on behalf of the user. + b. `load_modules` will iterate over the `doom.modules` field (set in `config.lua`), installing packer dependencies, binding autocmds and regular cmds. + c. `handle_user_config` will handle the user imported packages, autocmds and vim cmds from the `use_*` functions (from user's `config.lua` file). diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 636a603..91254e1 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -3,6 +3,8 @@ -- -- Finds and returns user's `modules.lua` file. Returned result is cached -- due to lua's `require` caching. +-- +-- Later on it executes all of the enabled modules, loading their packer dependencies, autocmds and cmds. local utils = require("doom.utils") local filename = "modules.lua"