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";
setCursorline = mkOption { setupOpts = {
type = bool; setCursorline = mkOption {
description = "Set a colored cursorline on current line"; type = bool;
default = false; # looks ugly, disabled by default description = "Set a colored cursorline on current line";
}; default = false; # looks ugly, disabled by default
colors = {
copy = mkOption {
type = str;
default = "#f5c359";
description = "The #RRGGBB color code for the visual mode highlights";
}; };
delete = mkOption { line_opacity = {
type = str; visual = mkOption {
default = "#c75c6a"; type = float;
description = "The #RRGGBB color code for the visual mode highlights"; description = "Set opacity for cursorline and number background";
default = 0.0;
};
}; };
insert = mkOption { colors = mkPluginSetupOption "modes.nvim" {
type = str; copy = mkOption {
default = "#78ccc5"; type = str;
description = "The #RRGGBB color code for the visual mode highlights"; description = "The #RRGGBB color code for the visual mode highlights";
}; default = "#f5c359";
};
visual = mkOption { delete = 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 = "#c75c6a";
};
insert = mkOption {
type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#78ccc5";
};
visual = mkOption {
type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#9745be";
};
}; };
}; };
}; };