mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-15 19:54:32 +02:00
plugins/spider: migrate to mkNeovimPlugin
Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
parent
d80d42f066
commit
82271c28ef
2 changed files with 49 additions and 50 deletions
|
@ -1,36 +1,26 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
pluginName = "spider";
|
inherit (lib) types;
|
||||||
cfg = config.plugins.${pluginName};
|
|
||||||
in
|
in
|
||||||
{
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
options.plugins.${pluginName} = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
name = "spider";
|
||||||
enable = mkEnableOption pluginName;
|
packPathName = "nvim-spider";
|
||||||
|
package = "nvim-spider";
|
||||||
package = lib.mkPackageOption pkgs pluginName {
|
maintainers = [ lib.maintainers.saygo-png ];
|
||||||
default = [
|
description = "Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.";
|
||||||
"vimPlugins"
|
|
||||||
"nvim-spider"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
skipInsignificantPunctuation = helpers.defaultNullOpts.mkBool true "Whether to skip insignificant punctuation.";
|
|
||||||
|
|
||||||
|
extraOptions = {
|
||||||
keymaps = {
|
keymaps = {
|
||||||
silent = mkOption {
|
silent = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
description = "Whether ${pluginName} keymaps should be silent.";
|
description = "Whether spider keymaps should be silent.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
motions = mkOption {
|
motions = lib.mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Mappings for spider motions.
|
Mappings for spider motions.
|
||||||
|
@ -48,13 +38,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
# TODO: introduced 2025-07-13: remove after 25.11
|
||||||
let
|
inherit (import ./deprecations.nix lib) deprecateExtraOptions imports;
|
||||||
setupOptions = {
|
|
||||||
inherit (cfg) skipInsignificantPunctuation;
|
|
||||||
} // cfg.extraOptions;
|
|
||||||
|
|
||||||
mappings = mapAttrsToList (motion: key: {
|
extraConfig = cfg: {
|
||||||
|
extraLuaPackages = luaPkgs: [ luaPkgs.luautf8 ];
|
||||||
|
|
||||||
|
keymaps = lib.mapAttrsToList (motion: key: {
|
||||||
mode = [
|
mode = [
|
||||||
"n"
|
"n"
|
||||||
"o"
|
"o"
|
||||||
|
@ -67,15 +57,5 @@ in
|
||||||
desc = "Spider-${motion}";
|
desc = "Spider-${motion}";
|
||||||
};
|
};
|
||||||
}) cfg.keymaps.motions;
|
}) cfg.keymaps.motions;
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
extraLuaPackages = luaPkgs: [ luaPkgs.luautf8 ];
|
|
||||||
|
|
||||||
keymaps = mappings;
|
|
||||||
|
|
||||||
extraConfigLua = ''
|
|
||||||
require("${pluginName}").setup(${lib.nixvim.toLuaObject setupOptions})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
19
plugins/by-name/spider/deprecations.nix
Normal file
19
plugins/by-name/spider/deprecations.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
lib: {
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
imports =
|
||||||
|
let
|
||||||
|
basePluginPath = [
|
||||||
|
"plugins"
|
||||||
|
"spider"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
[
|
||||||
|
(lib.mkRenamedOptionModule (basePluginPath ++ [ "skipInsignificantPunctuation" ]) (
|
||||||
|
basePluginPath
|
||||||
|
++ [
|
||||||
|
"settings"
|
||||||
|
"skipInsignificantPunctuation"
|
||||||
|
]
|
||||||
|
))
|
||||||
|
];
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue