Skip to content

Commit 82271c2

Browse files
saygo-pngGaetanLepage
authored andcommitted
plugins/spider: migrate to mkNeovimPlugin
Signed-off-by: saygo-png <[email protected]>
1 parent d80d42f commit 82271c2

File tree

2 files changed

+50
-51
lines changed

2 files changed

+50
-51
lines changed

plugins/by-name/spider/default.nix

Lines changed: 31 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
11
{
22
lib,
3-
helpers,
4-
config,
5-
pkgs,
63
...
74
}:
8-
with lib;
95
let
10-
pluginName = "spider";
11-
cfg = config.plugins.${pluginName};
6+
inherit (lib) types;
127
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 = {
2616
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.";
3020
default = false;
3121
};
3222

33-
motions = mkOption {
23+
motions = lib.mkOption {
3424
type = types.attrsOf types.str;
3525
description = ''
3626
Mappings for spider motions.
@@ -48,34 +38,24 @@ in
4838
};
4939
};
5040

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;
5643

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 ];
7646

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+
};
8161
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
lib: {
2+
deprecateExtraOptions = true;
3+
imports =
4+
let
5+
basePluginPath = [
6+
"plugins"
7+
"spider"
8+
];
9+
in
10+
[
11+
(lib.mkRenamedOptionModule (basePluginPath ++ [ "skipInsignificantPunctuation" ]) (
12+
basePluginPath
13+
++ [
14+
"settings"
15+
"skipInsignificantPunctuation"
16+
]
17+
))
18+
];
19+
}

0 commit comments

Comments
 (0)