nix-community.nixvim/plugins/ui/specs.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

138 lines
3.7 KiB
Nix
Raw Normal View History

{
lib,
helpers,
...
}:
with lib;
2024-09-01 12:52:28 +01:00
helpers.neovim-plugin.mkNeovimPlugin {
name = "specs";
originalName = "specs.nvim";
package = "specs-nvim";
maintainers = [ maintainers.GaetanLepage ];
# TODO: introduced 2024-06-10, remove on 2024-08-10
optionsRenamedToSettings = [
"show_jumps"
"min_jump"
];
imports =
let
basePluginPath = [
"plugins"
"specs"
];
settingsPath = basePluginPath ++ [ "settings" ];
renameToPopup =
old: new:
mkRenamedOptionModule (basePluginPath ++ [ old ]) (
settingsPath
++ [
"popup"
new
]
);
in
[
(renameToPopup "delay" "delay_ms")
(renameToPopup "increment" "inc_ms")
(renameToPopup "blend" "blend")
(renameToPopup "width" "width")
(mkRemovedOptionModule (
basePluginPath ++ [ "color" ]
) "Please, use `settings.popup.winhl` directly.")
(mkRemovedOptionModule (
basePluginPath ++ [ "fader" ]
) "Please, use `settings.popup.fader` directly.")
(mkRemovedOptionModule (
basePluginPath ++ [ "resizer" ]
) "Please, use `settings.popup.resizer` directly.")
(mkRemovedOptionModule (
basePluginPath ++ [ "ignored_filetypes" ]
) "Please, use `settings.ignore_filetypes` instead.")
(mkRemovedOptionModule (
basePluginPath ++ [ "ignored_buffertypes" ]
) "Please, use `settings.ignore_buftypes` instead.")
];
settingsOptions = {
show_jumps = helpers.defaultNullOpts.mkBool true ''
Whether to show an animation each time the cursor jumps.
'';
min_jump = helpers.defaultNullOpts.mkUnsignedInt 30 ''
Minimum jump distance to trigger the animation.
'';
popup = {
delay_ms = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Delay before popup displays.
'';
2021-12-11 23:02:59 -06:00
inc_ms = helpers.defaultNullOpts.mkUnsignedInt 5 ''
Time increments used for fade/resize effects.
'';
2022-11-27 16:55:34 -05:00
blend = helpers.defaultNullOpts.mkUnsignedInt 10 ''
Starting blend, between 0 (opaque) and 100 (transparent), see `:h winblend`.
'';
2021-12-11 23:02:59 -06:00
width = helpers.defaultNullOpts.mkUnsignedInt 20 ''
Width of the popup.
'';
2021-12-11 23:02:59 -06:00
winhl = helpers.defaultNullOpts.mkStr "PMenu" ''
The name of the window highlight group of the popup.
'';
2021-12-11 23:02:59 -06:00
fader = helpers.defaultNullOpts.mkLuaFn "require('specs').exp_fader" ''
The fader function to use.
'';
2021-12-11 23:02:59 -06:00
resizer = helpers.defaultNullOpts.mkLuaFn "require('specs').shrink_resizer" ''
The resizer function to use.
'';
2021-12-11 23:02:59 -06:00
};
ignore_filetypes = helpers.defaultNullOpts.mkAttrsOf types.bool { } ''
An attrs where keys are filetypes and values are a boolean stating whether animation should be
enabled or not for this filetype.
'';
2021-12-11 23:02:59 -06:00
ignore_buftypes = helpers.defaultNullOpts.mkAttrsOf types.bool { nofile = true; } ''
An attrs where keys are buftypes and values are a boolean stating whether animation should be
enabled or not for this buftype.
'';
2021-12-11 23:02:59 -06:00
};
settingsExample = {
show_jumps = true;
min_jump = 30;
popup = {
delay_ms = 0;
inc_ms = 10;
blend = 10;
width = 10;
winhl = "PMenu";
fader = ''
function(blend, cnt)
if cnt > 100 then
return 80
else return nil end
end
'';
resizer = ''
function(width, ccol, cnt)
if width-cnt > 0 then
return {width+cnt, ccol}
else return nil end
end
2021-12-11 23:02:59 -06:00
'';
};
ignore_filetypes = { };
ignore_buftypes = {
nofile = true;
};
};
2021-12-11 23:02:59 -06:00
}