nix-community.nixvim/plugins/by-name/spider/default.nix

62 lines
1.5 KiB
Nix
Raw Normal View History

{
lib,
...
}:
2024-05-05 19:39:35 +02:00
let
inherit (lib) types;
2024-05-05 19:39:35 +02:00
in
lib.nixvim.plugins.mkNeovimPlugin {
name = "spider";
packPathName = "nvim-spider";
package = "nvim-spider";
maintainers = [ lib.maintainers.saygo-png ];
description = "Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.";
extraOptions = {
2024-05-05 19:39:35 +02:00
keymaps = {
silent = lib.mkOption {
type = lib.types.bool;
description = "Whether spider keymaps should be silent.";
2024-05-05 19:39:35 +02:00
default = false;
};
motions = lib.mkOption {
2024-05-05 19:39:35 +02:00
type = types.attrsOf types.str;
description = ''
Mappings for spider motions.
The keys are the motion and the values are the keyboard shortcuts.
The shortcut might not necessarily be the same as the motion name.
'';
default = { };
example = {
w = "w";
e = "e";
b = "b";
ge = "ge";
};
};
};
2024-05-05 19:39:35 +02:00
};
# TODO: introduced 2025-07-13: remove after 25.11
inherit (import ./deprecations.nix lib) deprecateExtraOptions imports;
extraConfig = cfg: {
extraLuaPackages = luaPkgs: [ luaPkgs.luautf8 ];
keymaps = lib.mapAttrsToList (motion: key: {
mode = [
"n"
"o"
"x"
];
inherit key;
action.__raw = "function() require('spider').motion('${motion}') end";
options = {
inherit (cfg.keymaps) silent;
desc = "Spider-${motion}";
};
}) cfg.keymaps.motions;
};
}