mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-27 19:18:57 +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";
|
||||
|
||||
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 {
|
||||
type = with lib.types; attrsOf (attrsOf anything);
|
||||
default = { };
|
||||
|
@ -82,9 +90,23 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
callSetup = false;
|
||||
hasSettings = false;
|
||||
extraConfig = cfg: {
|
||||
extraConfigLua = lib.foldlAttrs (lines: name: config: ''
|
||||
${lines}
|
||||
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
|
||||
'') "" cfg.modules;
|
||||
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}
|
||||
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
|
||||
'') "" 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";
|
||||
foreground = "#cdc4c6";
|
||||
};
|
||||
icons = { };
|
||||
indentscope = { };
|
||||
jump = { };
|
||||
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