plugins/edgy: switch from mkDesc to pluginDefault

This commit is contained in:
Matt Sturgeon 2024-06-11 02:30:37 +01:00
parent a8943f2502
commit 44cd01b253
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -120,7 +120,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'' "Callback for the ending of animations."; '' "Callback for the ending of animations.";
# This option accepts an attrs or a lua string. # This option accepts an attrs or a lua string.
# Hence, we use `mkOption` to convert the string to raw lua in `apply`. # Hence, we convert the string to raw lua in `apply`.
spinner = spinner =
let let
defaultFrames = [ defaultFrames = [
@ -136,10 +136,9 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"" ""
]; ];
in in
mkOption { helpers.mkNullOrOption' {
type = type =
with helpers.nixvimTypes; with helpers.nixvimTypes;
nullOr (
either strLua (submodule { either strLua (submodule {
freeformType = attrsOf anything; freeformType = attrsOf anything;
options = { options = {
@ -151,15 +150,15 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Interval time between two consecutive frames. Interval time between two consecutive frames.
''; '';
}; };
}) });
);
default = null; default = null;
example = "require('noice.util.spinners').spinners.circleFull"; example = "require('noice.util.spinners').spinners.circleFull";
apply = v: if isString v then helpers.mkRaw v else v; apply = v: if isString v then helpers.mkRaw v else v;
description = helpers.defaultNullOpts.mkDesc { description = "Spinner for pinned views that are loading.";
pluginDefault = {
frames = defaultFrames; frames = defaultFrames;
interval = 80; interval = 80;
} "Spinner for pinned views that are loading."; };
}; };
}; };
@ -182,14 +181,20 @@ helpers.neovim-plugin.mkNeovimPlugin config {
} "Global window options for edgebar windows."; } "Global window options for edgebar windows.";
# This option accepts an attrs or a lua string. # This option accepts an attrs or a lua string.
# Hence, we use `mkOption` to convert the string to raw lua in `apply`. # Hence, we convert the string to raw lua in `apply`.
keys = mkOption { keys = helpers.defaultNullOpts.mkAttrsOf' {
type = with helpers.nixvimTypes; attrsOf (either strLuaFn (enum [ false ])); type = with helpers.nixvimTypes; either strLuaFn (enum [ false ]);
default = { }; apply = x: if x == null then null else mapAttrs (_: v: if isString v then helpers.mkRaw v else v) x;
apply = mapAttrs (_: v: if isString v then helpers.mkRaw v else v); description = ''
description = Buffer-local keymaps to be added to edgebar buffers.
helpers.defaultNullOpts.mkDesc Existing buffer-local keymaps will never be overridden.
{
Each value is either:
- A function declaration (as a raw lua string)
-> `fun(win:Edgy.Window)`
- `false` to disable this mapping.
'';
pluginDefault = {
q = '' q = ''
function(win) function(win)
win:close() win:close()
@ -250,16 +255,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
win.view.edgebar:equalize() win.view.edgebar:equalize()
end end
''; '';
} };
''
Buffer-local keymaps to be added to edgebar buffers.
Existing buffer-local keymaps will never be overridden.
Each value is either:
- A function declaration (as a raw lua string)
-> `fun(win:Edgy.Window)`
- `false` to disable this mapping.
'';
}; };
icons = { icons = {