mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-28 03:20:08 +02:00
plugins/mini-icons: add mockDevIcons
This commit is contained in:
parent
84249a9dab
commit
9a156ae60c
2 changed files with 35 additions and 4 deletions
|
@ -11,6 +11,14 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
package = "mini-nvim";
|
package = "mini-nvim";
|
||||||
|
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
|
mockDevIcons = lib.mkEnableOption "mockDevIcons" // {
|
||||||
|
defaultText = lib.literalMD "`false` **NOTE**: This option is experimental and the default value may change without notice.";
|
||||||
|
description = ''
|
||||||
|
Whether to tell `mini.icons` to emulate `nvim-web-devicons` for plugins that don't natively support it.
|
||||||
|
|
||||||
|
When enabled, you don't need to set `plugins.web-devicons.enable`. This will replace the need for it.
|
||||||
|
'';
|
||||||
|
};
|
||||||
modules = lib.mkOption {
|
modules = lib.mkOption {
|
||||||
type = with lib.types; attrsOf (attrsOf anything);
|
type = with lib.types; attrsOf (attrsOf anything);
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -82,9 +90,23 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
callSetup = false;
|
callSetup = false;
|
||||||
hasSettings = false;
|
hasSettings = false;
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
extraConfigLua = lib.foldlAttrs (lines: name: config: ''
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
|
||||||
|
message = ''
|
||||||
|
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
|
||||||
|
This setting will have no effect without it.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
extraConfigLua =
|
||||||
|
lib.foldlAttrs (lines: name: config: ''
|
||||||
${lines}
|
${lines}
|
||||||
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
|
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
|
||||||
'') "" cfg.modules;
|
'') "" cfg.modules
|
||||||
|
# `MiniIcons` is only in scope if we've called `require('mini.icons')` above
|
||||||
|
+ lib.optionalString ((cfg.modules ? icons) && cfg.mockDevIcons) ''
|
||||||
|
MiniIcons.mock_nvim_web_devicons()
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
background = "#351721";
|
background = "#351721";
|
||||||
foreground = "#cdc4c6";
|
foreground = "#cdc4c6";
|
||||||
};
|
};
|
||||||
|
icons = { };
|
||||||
indentscope = { };
|
indentscope = { };
|
||||||
jump = { };
|
jump = { };
|
||||||
jump2d = { };
|
jump2d = { };
|
||||||
|
@ -77,4 +78,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
icons-mock = {
|
||||||
|
plugins.mini = {
|
||||||
|
enable = true;
|
||||||
|
mockDevIcons = true;
|
||||||
|
modules.icons = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue