nix-community.nixvim/plugins/utils/quickmath.nix

42 lines
819 B
Nix
Raw Normal View History

2023-07-01 08:57:44 +02:00
{
lib,
helpers,
config,
pkgs,
2023-07-01 08:57:44 +02:00
...
}:
2024-05-05 19:39:35 +02:00
with lib;
let
2023-07-01 08:57:44 +02:00
cfg = config.plugins.quickmath;
2024-05-05 19:39:35 +02:00
in
{
2023-07-01 08:57:44 +02:00
options.plugins.quickmath = {
enable = mkEnableOption "quickmath.nvim";
package = helpers.mkPluginPackageOption "quickmath.nvim" pkgs.vimPlugins.quickmath-nvim;
2023-07-01 08:57:44 +02:00
keymap = {
key = helpers.mkNullOrOption types.str "Keymap to run the `:Quickmath` command.";
silent = mkOption {
type = types.bool;
description = "Whether the quickmath keymap should be silent.";
default = false;
};
};
};
config = mkIf cfg.enable {
2024-05-05 19:39:35 +02:00
extraPlugins = [ cfg.package ];
2023-07-01 08:57:44 +02:00
2024-05-05 19:39:35 +02:00
keymaps =
with cfg.keymap;
optional (key != null) {
mode = "n";
inherit key;
2023-07-01 08:57:44 +02:00
action = ":Quickmath<CR>";
options.silent = cfg.keymap.silent;
2023-07-01 08:57:44 +02:00
};
};
}