feat(modes): custom setup opts

This commit is contained in:
Ching Pei Yang 2024-03-10 19:02:04 +00:00
parent 5387ca2b5a
commit 64f167e7c5
2 changed files with 36 additions and 39 deletions

View file

@ -4,8 +4,8 @@
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.ui.modes-nvim; cfg = config.vim.ui.modes-nvim;
in { in {
@ -15,18 +15,7 @@ in {
]; ];
vim.luaConfigRC.modes-nvim = entryAnywhere '' vim.luaConfigRC.modes-nvim = entryAnywhere ''
require('modes').setup({ require('modes').setup(${toLuaObject cfg.setupOpts})
set_cursorline = ${boolToString cfg.setCursorline},
line_opacity = {
visual = 0,
},
colors = {
copy = "${toString cfg.colors.copy}",
delete = "${toString cfg.colors.delete}",
insert = "${toString cfg.colors.insert}",
visual = "${toString cfg.colors.visual}",
},
})
''; '';
}; };
} }

View file

@ -1,39 +1,47 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) str; inherit (lib.types) bool str float;
inherit (lib.nvim.types) mkPluginSetupOption;
in { in {
options.vim.ui.modes-nvim = { options.vim.ui.modes-nvim = {
enable = mkEnableOption "modes.nvim's prismatic line decorations"; enable = mkEnableOption "modes.nvim's prismatic line decorations";
setupOpts = {
setCursorline = mkOption { setCursorline = mkOption {
type = bool; type = bool;
description = "Set a colored cursorline on current line"; description = "Set a colored cursorline on current line";
default = false; # looks ugly, disabled by default default = false; # looks ugly, disabled by default
}; };
colors = { line_opacity = {
visual = mkOption {
type = float;
description = "Set opacity for cursorline and number background";
default = 0.0;
};
};
colors = mkPluginSetupOption "modes.nvim" {
copy = mkOption { copy = mkOption {
type = str; type = str;
default = "#f5c359";
description = "The #RRGGBB color code for the visual mode highlights"; description = "The #RRGGBB color code for the visual mode highlights";
default = "#f5c359";
}; };
delete = mkOption { delete = mkOption {
type = str; type = str;
default = "#c75c6a";
description = "The #RRGGBB color code for the visual mode highlights"; description = "The #RRGGBB color code for the visual mode highlights";
default = "#c75c6a";
}; };
insert = mkOption { insert = mkOption {
type = str; type = str;
default = "#78ccc5";
description = "The #RRGGBB color code for the visual mode highlights"; description = "The #RRGGBB color code for the visual mode highlights";
default = "#78ccc5";
}; };
visual = mkOption { visual = mkOption {
type = str; type = str;
default = "#9745be";
description = "The #RRGGBB color code for the visual mode highlights"; description = "The #RRGGBB color code for the visual mode highlights";
default = "#9745be";
};
}; };
}; };
}; };