mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-03 05:44:31 +02:00
plugins/quickmath: init + test
This commit is contained in:
parent
341eb9d094
commit
269d592ea8
3 changed files with 54 additions and 0 deletions
|
@ -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
|
||||||
|
|
37
plugins/utils/quickmath.nix
Normal file
37
plugins/utils/quickmath.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
16
tests/test-sources/plugins/utils/quickmath.nix
Normal file
16
tests/test-sources/plugins/utils/quickmath.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.quickmath.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins.quickmath = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymap = {
|
||||||
|
key = "<leader>q";
|
||||||
|
silent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue