Discovers and evaluates config files and user modules at startup.
Load order (both startup and reload)
~/.config/minga/modules/*.ex(compile user modules)~/.config/minga/themes/*.exs(load user themes, before config eval)~/.config/minga/config.exs(global config).minga.exsin the current working directory (project-local config)~/.config/minga/after.exs(post-init hook)
Later sources override earlier ones (last-writer-wins for options and keybindings). Errors at any stage are captured and stored for the editor to display as status bar warnings.
Config file locations
$XDG_CONFIG_HOME/minga/config.exs(if$XDG_CONFIG_HOMEis set)~/.config/minga/config.exs
If the file doesn't exist, the editor starts with defaults. No error, no warning.
Summary
Functions
Returns the after.exs load error, or nil if clean (or no after.exs).
Returns a specification to start this module under a supervisor.
Returns the resolved global config file path.
Returns the last global config load error, or nil if config loaded cleanly
(or no config file exists).
Returns the list of modules compiled from the user's modules directory.
Returns compilation errors from user modules, or an empty list if all compiled cleanly.
Returns the project-local config load error, or nil if clean (or no project config).
Reloads all config from scratch.
Starts the loader, compiles user modules, and evaluates all config files.
Types
@type state() :: %{ config_path: String.t(), load_error: String.t() | nil, loaded_modules: [module()], modules_errors: [String.t()], project_config_path: String.t() | nil, project_config_error: String.t() | nil, after_error: String.t() | nil }
Loader state: stores paths, loaded modules, and any errors from each stage.
Functions
@spec after_error() :: String.t() | nil
Returns the after.exs load error, or nil if clean (or no after.exs).
@spec after_error(GenServer.server()) :: String.t() | nil
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec config_path() :: String.t()
Returns the resolved global config file path.
This path is used by SPC f p to open the config file for editing.
@spec config_path(GenServer.server()) :: String.t()
@spec load_error() :: String.t() | nil
Returns the last global config load error, or nil if config loaded cleanly
(or no config file exists).
@spec load_error(GenServer.server()) :: String.t() | nil
@spec loaded_modules() :: [module()]
Returns the list of modules compiled from the user's modules directory.
@spec loaded_modules(GenServer.server()) :: [module()]
@spec modules_errors() :: [String.t()]
Returns compilation errors from user modules, or an empty list if all compiled cleanly.
@spec modules_errors(GenServer.server()) :: [String.t()]
@spec project_config_error() :: String.t() | nil
Returns the project-local config load error, or nil if clean (or no project config).
@spec project_config_error(GenServer.server()) :: String.t() | nil
@spec reload() :: :ok | {:error, String.t()}
Reloads all config from scratch.
Purges previously loaded user modules, resets Options, Hooks,
Keymap.Active, and Command.Registry to defaults, then re-runs the
full load sequence. Returns :ok on success or {:error, reason}
if something went wrong (errors are also stored in state).
@spec reload(GenServer.server()) :: :ok | {:error, String.t()}
@spec start_link(keyword()) :: Agent.on_start()
Starts the loader, compiles user modules, and evaluates all config files.