nix-community.nixvim/plugins/utils/quickmath.nix
2023-10-02 15:23:54 +02:00

39 lines
850 B
Nix

{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.plugins.quickmath;
helpers = import ../helpers.nix {inherit lib;};
in {
options.plugins.quickmath = {
enable = mkEnableOption "quickmath.nvim";
package = helpers.mkPackageOption "quickmath.nvim" pkgs.vimPlugins.quickmath-nvim;
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 {
extraPlugins = [cfg.package];
keymaps = with cfg.keymap;
optional (key != null)
{
mode = "n";
inherit key;
action = ":Quickmath<CR>";
options.silent = cfg.keymap.silent;
};
};
}