|
1 | 1 | {
|
2 | 2 | lib,
|
3 |
| - helpers, |
4 |
| - config, |
5 |
| - pkgs, |
6 | 3 | ...
|
7 | 4 | }:
|
8 |
| -with lib; |
9 | 5 | let
|
10 |
| - pluginName = "spider"; |
11 |
| - cfg = config.plugins.${pluginName}; |
| 6 | + inherit (lib) types; |
12 | 7 | in
|
13 |
| -{ |
14 |
| - options.plugins.${pluginName} = lib.nixvim.plugins.neovim.extraOptionsOptions // { |
15 |
| - enable = mkEnableOption pluginName; |
16 |
| - |
17 |
| - package = lib.mkPackageOption pkgs pluginName { |
18 |
| - default = [ |
19 |
| - "vimPlugins" |
20 |
| - "nvim-spider" |
21 |
| - ]; |
22 |
| - }; |
23 |
| - |
24 |
| - skipInsignificantPunctuation = helpers.defaultNullOpts.mkBool true "Whether to skip insignificant punctuation."; |
25 |
| - |
| 8 | +lib.nixvim.plugins.mkNeovimPlugin { |
| 9 | + name = "spider"; |
| 10 | + packPathName = "nvim-spider"; |
| 11 | + package = "nvim-spider"; |
| 12 | + maintainers = [ lib.maintainers.saygo-png ]; |
| 13 | + description = "Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation."; |
| 14 | + |
| 15 | + extraOptions = { |
26 | 16 | keymaps = {
|
27 |
| - silent = mkOption { |
28 |
| - type = types.bool; |
29 |
| - description = "Whether ${pluginName} keymaps should be silent."; |
| 17 | + silent = lib.mkOption { |
| 18 | + type = lib.types.bool; |
| 19 | + description = "Whether spider keymaps should be silent."; |
30 | 20 | default = false;
|
31 | 21 | };
|
32 | 22 |
|
33 |
| - motions = mkOption { |
| 23 | + motions = lib.mkOption { |
34 | 24 | type = types.attrsOf types.str;
|
35 | 25 | description = ''
|
36 | 26 | Mappings for spider motions.
|
|
48 | 38 | };
|
49 | 39 | };
|
50 | 40 |
|
51 |
| - config = |
52 |
| - let |
53 |
| - setupOptions = { |
54 |
| - inherit (cfg) skipInsignificantPunctuation; |
55 |
| - } // cfg.extraOptions; |
| 41 | + # TODO: introduced 2025-07-13: remove after 25.11 |
| 42 | + inherit (import ./deprecations.nix lib) deprecateExtraOptions imports; |
56 | 43 |
|
57 |
| - mappings = mapAttrsToList (motion: key: { |
58 |
| - mode = [ |
59 |
| - "n" |
60 |
| - "o" |
61 |
| - "x" |
62 |
| - ]; |
63 |
| - inherit key; |
64 |
| - action.__raw = "function() require('spider').motion('${motion}') end"; |
65 |
| - options = { |
66 |
| - inherit (cfg.keymaps) silent; |
67 |
| - desc = "Spider-${motion}"; |
68 |
| - }; |
69 |
| - }) cfg.keymaps.motions; |
70 |
| - in |
71 |
| - mkIf cfg.enable { |
72 |
| - extraPlugins = [ cfg.package ]; |
73 |
| - extraLuaPackages = luaPkgs: [ luaPkgs.luautf8 ]; |
74 |
| - |
75 |
| - keymaps = mappings; |
| 44 | + extraConfig = cfg: { |
| 45 | + extraLuaPackages = luaPkgs: [ luaPkgs.luautf8 ]; |
76 | 46 |
|
77 |
| - extraConfigLua = '' |
78 |
| - require("${pluginName}").setup(${lib.nixvim.toLuaObject setupOptions}) |
79 |
| - ''; |
80 |
| - }; |
| 47 | + keymaps = lib.mapAttrsToList (motion: key: { |
| 48 | + mode = [ |
| 49 | + "n" |
| 50 | + "o" |
| 51 | + "x" |
| 52 | + ]; |
| 53 | + inherit key; |
| 54 | + action.__raw = "function() require('spider').motion('${motion}') end"; |
| 55 | + options = { |
| 56 | + inherit (cfg.keymaps) silent; |
| 57 | + desc = "Spider-${motion}"; |
| 58 | + }; |
| 59 | + }) cfg.keymaps.motions; |
| 60 | + }; |
81 | 61 | }
|
0 commit comments