2024-09-05 16:56:34 +00:00
|
|
|
{ lib, ... }:
|
|
|
|
let
|
2024-09-29 09:19:31 -05:00
|
|
|
inherit (lib.nixvim) defaultNullOpts mkNullOrOption toLuaObject;
|
2024-09-05 16:56:34 +00:00
|
|
|
in
|
|
|
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|
|
|
name = "web-devicons";
|
2024-12-13 08:27:14 -06:00
|
|
|
packPathName = "nvim-web-devicons";
|
2024-12-13 08:28:39 -06:00
|
|
|
moduleName = "nvim-web-devicons";
|
2024-09-05 16:56:34 +00:00
|
|
|
package = "nvim-web-devicons";
|
|
|
|
|
|
|
|
maintainers = [ lib.maintainers.refaelsh ];
|
|
|
|
|
|
|
|
settingsExample = {
|
|
|
|
color_icons = true;
|
|
|
|
strict = true;
|
|
|
|
};
|
2024-09-29 09:19:31 -05:00
|
|
|
|
|
|
|
extraOptions = {
|
|
|
|
customIcons = defaultNullOpts.mkAttrsOf (lib.types.submodule {
|
|
|
|
freeformType = lib.types.anything;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
icon = defaultNullOpts.mkStr null "Icon to use.";
|
|
|
|
color = defaultNullOpts.mkStr null "Color of the icon.";
|
|
|
|
cterm_color = defaultNullOpts.mkStr null "Cterm color of the icon.";
|
|
|
|
name = defaultNullOpts.mkStr null "Name to replace with icon.";
|
|
|
|
};
|
|
|
|
}) { } ''Custom overrides for icons.'';
|
|
|
|
|
|
|
|
defaultIcon = mkNullOrOption (lib.types.submodule {
|
|
|
|
options = {
|
|
|
|
icon = defaultNullOpts.mkStr null "Icon to use.";
|
|
|
|
color = defaultNullOpts.mkStr null "Color of the icon.";
|
|
|
|
cterm_color = defaultNullOpts.mkStr null "Cterm color of the icon.";
|
|
|
|
};
|
|
|
|
}) ''Set the default icon when none is found.'';
|
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = cfg: {
|
|
|
|
plugins.web-devicons.luaConfig.post =
|
|
|
|
lib.optionalString (cfg.customIcons != null) ''
|
|
|
|
require('nvim-web-devicons').set_icon(${toLuaObject cfg.customIcons})
|
|
|
|
''
|
|
|
|
+ lib.optionalString (cfg.defaultIcon != null) ''
|
|
|
|
require('nvim-web-devicons').set_default_icon(
|
|
|
|
${toLuaObject cfg.defaultIcon.icon}, ${toLuaObject cfg.defaultIcon.color}, ${toLuaObject cfg.defaultIcon.cterm_color})
|
|
|
|
'';
|
|
|
|
};
|
2024-09-05 16:56:34 +00:00
|
|
|
}
|