plugins/quickmath: init + test

This commit is contained in:
Gaetan Lepage 2023-07-01 08:57:44 +02:00 committed by Gaétan Lepage
parent 341eb9d094
commit 269d592ea8
3 changed files with 54 additions and 0 deletions

View file

@ -107,6 +107,7 @@
./utils/oil.nix ./utils/oil.nix
./utils/project-nvim.nix ./utils/project-nvim.nix
./utils/presence-nvim.nix ./utils/presence-nvim.nix
./utils/quickmath.nix
./utils/specs.nix ./utils/specs.nix
./utils/spider.nix ./utils/spider.nix
./utils/startify.nix ./utils/startify.nix

View file

@ -0,0 +1,37 @@
{
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];
maps.normal = mkIf (cfg.keymap.key != null) {
${cfg.keymap.key} = {
action = ":Quickmath<CR>";
inherit (cfg.keymap) silent;
};
};
};
}

View file

@ -0,0 +1,16 @@
{
empty = {
plugins.quickmath.enable = true;
};
example = {
plugins.quickmath = {
enable = true;
keymap = {
key = "<leader>q";
silent = true;
};
};
};
}