Compare commits

..

5 Commits

6 changed files with 41 additions and 12 deletions

View File

@ -50,18 +50,34 @@ in {
...
}: let
pkg = pkgs.wrapNeovimUnstable config.package config.neovimOptions;
luaRcContent = config.init.finalContent;
inherit (config) extraLuaPackages;
neovim-unwrapped = config.package;
inherit (neovim-unwrapped.lua.pkgs.luaLib) genLuaPathAbsStr genLuaCPathAbsStr;
luaEnv = neovim-unwrapped.lua.withPackages extraLuaPackages;
neovimOptions = pkgs.neovimUtils.makeNeovimConfig rec {
inherit (config) extraLuaPackages viAlias vimAlias;
neovimOptions = {
inherit extraLuaPackages luaRcContent;
inherit (config) viAlias vimAlias;
customLuaRC = config.init.finalContent;
wrapRc = customLuaRC != null;
wrapRc = luaRcContent != null;
plugins = concatLists [
(map modules.plugin.extract config.plugins)
(optional (! isNull config.runtime) config.runtime.package)
[config.slothPlugin]
];
wrapperArgs = lib.optionals (luaEnv != null) [
"--prefix"
"LUA_PATH"
";"
(genLuaPathAbsStr luaEnv)
"--prefix"
"LUA_CPATH"
";"
(genLuaCPathAbsStr luaEnv)
];
};
neovimPackage = pkg.overrideAttrs (final: super: {

View File

@ -57,7 +57,7 @@ in
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code to call before plugins loaded
Lua code to call before loading any plugins or even any sloth-flake calls.
'';
};
@ -65,7 +65,7 @@ in
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code called after init but before import
Lua code called after every non-lazy plugins init but before loading any plugin.
'';
};
@ -73,7 +73,7 @@ in
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code called after all plugins are loaded
Lua code called after all plugins are loaded and configured.
'';
};
@ -90,7 +90,12 @@ in
option = mkOption {
default = null;
description = ''
init.lua configuration
init.lua configuration can be a string, a path or attribute set.
The attribute set form will call sloth-flake for you and load your
plugins. It allows you to hook at different moments in the loading
process of your plugins: before everything, after all plugins init code
is called and after everything is loaded.
'';
type = with types; coercedTo (nullOr (oneOf [path str])) coerceToModule self.module;
example = ./init.lua;

View File

@ -16,8 +16,8 @@ local function describe(dep)
utils.info('Name: %s', dep.name)
utils.info('Is loaded: %s', yesno(dep.is_loaded))
utils.info('Is lazy: %s', yesno(dep.is_lazy))
utils.info('Has init: %s', yesno(dep.init))
utils.info('Has config: %s', yesno(dep.config))
utils.info('Has init: %s', yesno(dep.has_init))
utils.info('Has config: %s', yesno(dep.has_config))
utils.info('Dependencies: %s', list(dep.dependency_names))
utils.info('Filetypes: %s', list(dep.ft))
utils.info('Commands: %s', list(dep.cmd))

View File

@ -38,7 +38,7 @@ return {
local filter_name = args[1] or "all"
local filter = filters[filter_name]
if not filter then
utils.error([[No Sloth list filter "%s".]], cmd)
utils.error([[No Sloth list filter "%s".]], filter_name)
utils.error("Filters are: %s", vim.iter(vim.tbl_keys(filters)):join(', '))
return
end

View File

@ -131,6 +131,14 @@ function M:get_is_loaded()
return self.state >= State.Loaded
end
function M:get_has_init()
return not not self.values.init
end
function M:get_has_config()
return not not self.values.config
end
function M:get_has_events()
return self.ft or self.events
end

View File

@ -33,7 +33,7 @@ function M.dep_names()
end
function M.dep_names_by(fn)
return M.deps_iter_by(fn):map(function(v) return v:name() end)
return M.deps_iter_by(fn):map(function(v) return v.name end)
end
function M.deps_iter_by(fn)